diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 16:54:55 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 16:54:55 +0000 |
commit | 00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6 (patch) | |
tree | f5e127d2e169a0eb93c66d5c76852303d4a10f0c /src/file.cpp | |
parent | 9098237f5bb16b204a5ea999b702e5eb170f68ac (diff) | |
download | libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.tar.gz libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.tar.bz2 libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.tar.xz libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.zip |
Corrected the Bu::File::canRead() and Bu::File::canWrite() functions, they work
now. It helps to read the system docs. Anyway, nids is all fixed up, it seems
to work great now, and I guess I got all the corner cases we'll hit for a while,
fishtrax really did a number on them :)
I also cleaned up all the debugging output, now you can see your program run
instead of libbu++ internals.
There could still be a good amount of improvement made in nids, it really
shouldn't re-write whole blocks every time you write to a stream, but that will
be an easy change down the line that won't effect any of the existing code.
Diffstat (limited to '')
-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 | ||