From 9098237f5bb16b204a5ea999b702e5eb170f68ac Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 27 Jan 2009 15:25:46 +0000 Subject: 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. --- src/file.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/file.cpp') 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() bool Bu::File::canRead() { +#ifdef WIN32 return true; +#else + return (fcntl( fd, F_GETFL, 0 )&O_RDONLY) == O_RDONLY; +#endif } bool Bu::File::canWrite() { +#ifdef WIN32 return true; +#else + return (fcntl( fd, F_GETFL, 0 )&O_WRONLY) == O_WRONLY; +#endif } bool Bu::File::isReadable() -- cgit v1.2.3