diff options
Diffstat (limited to 'src/file.cpp')
-rw-r--r-- | src/file.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/file.cpp b/src/file.cpp index 20ff5c9..aa0ea32 100644 --- a/src/file.cpp +++ b/src/file.cpp | |||
@@ -113,7 +113,10 @@ bool Bu::File::canRead() | |||
113 | #ifdef WIN32 | 113 | #ifdef WIN32 |
114 | return true; | 114 | return true; |
115 | #else | 115 | #else |
116 | return (fcntl( fd, F_GETFL, 0 )&O_RDONLY) == O_RDONLY; | 116 | int iMode = fcntl( fd, F_GETFL, 0 )&O_ACCMODE; |
117 | if( iMode == O_RDONLY || iMode == O_RDWR ) | ||
118 | return true; | ||
119 | return false; | ||
117 | #endif | 120 | #endif |
118 | } | 121 | } |
119 | 122 | ||
@@ -122,7 +125,10 @@ bool Bu::File::canWrite() | |||
122 | #ifdef WIN32 | 125 | #ifdef WIN32 |
123 | return true; | 126 | return true; |
124 | #else | 127 | #else |
125 | return (fcntl( fd, F_GETFL, 0 )&O_WRONLY) == O_WRONLY; | 128 | int iMode = fcntl( fd, F_GETFL, 0 )&O_ACCMODE; |
129 | if( iMode == O_WRONLY || iMode == O_RDWR ) | ||
130 | return true; | ||
131 | return false; | ||
126 | #endif | 132 | #endif |
127 | } | 133 | } |
128 | 134 | ||