mirror of
https://github.com/wiiu-env/wudd.git
synced 2024-11-25 03:06:57 +01:00
Properly check write results
This commit is contained in:
parent
4a6269a8e5
commit
bc74da90dc
@ -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;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ WriteOnlyFileWithCache::~WriteOnlyFileWithCache() {
|
||||
bool WriteOnlyFileWithCache::flush() {
|
||||
if (this->writeBufferPos > 0) {
|
||||
int32_t res = CFile::write(static_cast<const uint8_t *>(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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user