From afe42fa505e0df93d87d0bfba66d6e238ea6f1bd Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 8 Apr 2015 12:08:46 -0700 Subject: [PATCH] Log an error if ftruncate() fails. --- Core/FileSystems/DirectoryFileSystem.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 83440ed5cc..35bd4cec6e 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -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