aboutsummaryrefslogtreecommitdiff
path: root/src/file.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-12-20 02:01:44 +0000
committerMike Buland <eichlan@xagasoft.com>2008-12-20 02:01:44 +0000
commitb7a687b08e32adafbb609bec7aa79b54f161ee4c (patch)
tree9c0214eb7fa5c69619bb4226cb292d19445b92df /src/file.cpp
parent5db154c3fb36a677c551e39c3c6661207eb51778 (diff)
downloadlibbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.tar.gz
libbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.tar.bz2
libbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.tar.xz
libbu++-b7a687b08e32adafbb609bec7aa79b54f161ee4c.zip
All of the basic, core workings of the Cache are complete, and tested. Even
added some more tests and whatnot. A lot happened, but I can't remember everything. Also, Bu::File reports errors in more error cases.
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()