diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 15:25:46 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 15:25:46 +0000 |
| commit | 9098237f5bb16b204a5ea999b702e5eb170f68ac (patch) | |
| tree | ddf0c3013f0877d1f406401c6b4509d11bfb23e3 /src/file.cpp | |
| parent | 8bc5ac336d5d684341a05e97d1cb1b18ecba0331 (diff) | |
| download | libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.tar.gz libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.tar.bz2 libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.tar.xz libbu++-9098237f5bb16b204a5ea999b702e5eb170f68ac.zip | |
Corrected some larger read/write issues in corner cases that I hit suprisingly
often within nids. There's still a problem somewhere, but I'll find it.
Also, even after having the file class canRead and canWrite functions work
properly, and using them before trying to write to a nids to update info, we
never ever write anything, so something is still wrong there. For now, all
utilities that open a nids stream read-only will crash when it closes. Pretty
minor really.
Diffstat (limited to '')
| -rw-r--r-- | src/file.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/file.cpp b/src/file.cpp index 7c18a06..20ff5c9 100644 --- a/src/file.cpp +++ b/src/file.cpp | |||
| @@ -110,12 +110,20 @@ bool Bu::File::isEOS() | |||
| 110 | 110 | ||
| 111 | bool Bu::File::canRead() | 111 | bool Bu::File::canRead() |
| 112 | { | 112 | { |
| 113 | #ifdef WIN32 | ||
| 113 | return true; | 114 | return true; |
| 115 | #else | ||
| 116 | return (fcntl( fd, F_GETFL, 0 )&O_RDONLY) == O_RDONLY; | ||
| 117 | #endif | ||
| 114 | } | 118 | } |
| 115 | 119 | ||
| 116 | bool Bu::File::canWrite() | 120 | bool Bu::File::canWrite() |
| 117 | { | 121 | { |
| 122 | #ifdef WIN32 | ||
| 118 | return true; | 123 | return true; |
| 124 | #else | ||
| 125 | return (fcntl( fd, F_GETFL, 0 )&O_WRONLY) == O_WRONLY; | ||
| 126 | #endif | ||
| 119 | } | 127 | } |
| 120 | 128 | ||
| 121 | bool Bu::File::isReadable() | 129 | bool Bu::File::isReadable() |
