diff --git a/source/fs/WUXFileWriter.cpp b/source/fs/WUXFileWriter.cpp index 15482c2..e15a121 100644 --- a/source/fs/WUXFileWriter.cpp +++ b/source/fs/WUXFileWriter.cpp @@ -76,7 +76,7 @@ int32_t WUXFileWriter::writeSector(const uint8_t *buffer, uint32_t numberOfSecto indexTable[this->currentSector] = swap_uint32(this->writtenSector); hashMap[hashOut] = writtenSector; if (isOpen()) { - if (!write((uint8_t *) addr, this->sectorSize)) { + if (write((uint8_t *) addr, this->sectorSize) != this->sectorSize) { DEBUG_FUNCTION_LINE_ERR("Write failed"); return -1; } diff --git a/source/fs/WriteOnlyFileWithCache.cpp b/source/fs/WriteOnlyFileWithCache.cpp index 4379c7e..62ecb3f 100644 --- a/source/fs/WriteOnlyFileWithCache.cpp +++ b/source/fs/WriteOnlyFileWithCache.cpp @@ -45,7 +45,7 @@ WriteOnlyFileWithCache::~WriteOnlyFileWithCache() { bool WriteOnlyFileWithCache::flush() { if (this->writeBufferPos > 0) { int32_t res = CFile::write(static_cast(this->writeBuffer), this->writeBufferPos); - if (res < 0) { + if (res != this->writeBufferPos) { DEBUG_FUNCTION_LINE_ERR("Failed to flush cache, write failed: %d (expected %d)", res, this->writeBufferPos); return false; }