fs/io/FileOutputStream: don't auto-delete file on WIN32

The file handle is never reset to INVALID_HANDLE_VALUE, and thus the
destructor will assume the operation shall be cancelled and will
delete the temporary file.

This was a major breakage for saving the database file and the state
file.
This commit is contained in:
Max Kellermann
2015-02-06 14:36:55 +01:00
parent b3fe3e8b3d
commit d38034bb5c
2 changed files with 3 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ FileOutputStream::Commit(gcc_unused Error &error)
assert(IsDefined());
CloseHandle(handle);
handle = INVALID_HANDLE_VALUE;
return true;
}
@@ -71,6 +72,7 @@ FileOutputStream::Cancel()
assert(IsDefined());
CloseHandle(handle);
handle = INVALID_HANDLE_VALUE;
RemoveFile(path);
}