Skip to content

Commit

Permalink
Delete the empty file if there isn't enough disk space
Browse files Browse the repository at this point in the history
  • Loading branch information
0xC0000054 committed Dec 28, 2024
1 parent 8aef61f commit 0372a50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/win/FileIOWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ class FileHandleWin : public FileHandle
// file without preallocating it.
if (lastError == ERROR_DISK_FULL || lastError == ERROR_FILE_TOO_LARGE)
{
// Throw the exception after closing the file handle.
// Throw the exception after closing the file handle and deleting
// the file we just created.
hFile.reset();
DeleteFileW(path.c_str());
THROW_WIN32(lastError);
}
}
Expand Down

0 comments on commit 0372a50

Please sign in to comment.