summaryrefslogtreecommitdiff
path: root/src/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/file.cpp')
-rw-r--r--src/file.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/file.cpp b/src/file.cpp
index 6e9d47e..7c18a06 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -54,7 +54,10 @@ size_t Bu::File::read( void *pBuf, size_t nBytes )
54 if( fd < 0 ) 54 if( fd < 0 )
55 throw FileException("File not open."); 55 throw FileException("File not open.");
56 56
57 return ::read( fd, pBuf, nBytes ); 57 ssize_t iRead = ::read( fd, pBuf, nBytes );
58 if( iRead < 0 )
59 throw FileException( errno, "%s", strerror( errno ) );
60 return iRead;
58} 61}
59 62
60size_t Bu::File::write( const void *pBuf, size_t nBytes ) 63size_t Bu::File::write( const void *pBuf, size_t nBytes )
@@ -62,7 +65,10 @@ size_t Bu::File::write( const void *pBuf, size_t nBytes )
62 if( fd < 0 ) 65 if( fd < 0 )
63 throw FileException("File not open."); 66 throw FileException("File not open.");
64 67
65 return ::write( fd, pBuf, nBytes ); 68 ssize_t iWrote = ::write( fd, pBuf, nBytes );
69 if( iWrote < 0 )
70 throw FileException( errno, "%s", strerror( errno ) );
71 return iWrote;
66} 72}
67 73
68long Bu::File::tell() 74long Bu::File::tell()