From d38034bb5c7bb58c01ce817fbeb394b178961a13 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Feb 2015 14:36:55 +0100 Subject: 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. --- src/fs/io/FileOutputStream.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/fs/io') diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx index dc4456d1f..0eff8b5f0 100644 --- a/src/fs/io/FileOutputStream.cxx +++ b/src/fs/io/FileOutputStream.cxx @@ -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); } -- cgit v1.2.3