From b7a687b08e32adafbb609bec7aa79b54f161ee4c Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 20 Dec 2008 02:01:44 +0000 Subject: 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. --- src/file.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') 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 ) if( fd < 0 ) throw FileException("File not open."); - return ::read( fd, pBuf, nBytes ); + ssize_t iRead = ::read( fd, pBuf, nBytes ); + if( iRead < 0 ) + throw FileException( errno, "%s", strerror( errno ) ); + return iRead; } size_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 ) if( fd < 0 ) throw FileException("File not open."); - return ::write( fd, pBuf, nBytes ); + ssize_t iWrote = ::write( fd, pBuf, nBytes ); + if( iWrote < 0 ) + throw FileException( errno, "%s", strerror( errno ) ); + return iWrote; } long Bu::File::tell() -- cgit v1.2.3