Log an error if ftruncate() fails.

This commit is contained in:
Unknown W. Brackets 2015-04-08 12:08:46 -07:00
parent 08032e4b14
commit afe42fa505

View File

@ -381,9 +381,13 @@ void DirectoryFileHandle::Close()
if (needsTrunc_ != -1) {
#ifdef _WIN32
Seek((s32)needsTrunc_, FILEMOVE_BEGIN);
SetEndOfFile(hFile);
if (SetEndOfFile(hFile) == 0) {
ERROR_LOG_REPORT(FILESYS, "Failed to truncate file.");
}
#else
ftruncate(hFile, (off_t)needsTrunc_);
if (ftruncate(hFile, (off_t)needsTrunc_) != 0) {
ERROR_LOG_REPORT(FILESYS, "Failed to truncate file.");
}
#endif
}
#ifdef _WIN32