diff --git a/encfs/BlockFileIO.cpp b/encfs/BlockFileIO.cpp index ba9d060..73da4dd 100644 --- a/encfs/BlockFileIO.cpp +++ b/encfs/BlockFileIO.cpp @@ -178,6 +178,8 @@ bool BlockFileIO::write(const IORequest &req) { rAssert(_blockSize != 0); off_t fileSize = getSize(); + if (fileSize < 0) + return false; // where write request begins off_t blockNum = req.offset / _blockSize; diff --git a/encfs/RawFileIO.cpp b/encfs/RawFileIO.cpp index 339a3f9..7395d46 100644 --- a/encfs/RawFileIO.cpp +++ b/encfs/RawFileIO.cpp @@ -178,8 +178,10 @@ off_t RawFileIO::getSize() const { const_cast(this)->fileSize = stbuf.st_size; const_cast(this)->knownSize = true; return fileSize; - } else + } else { + rError("getSize on %s failed: %s", name.c_str(), strerror(errno)); return -1; + } } else { return fileSize; }