aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-02-06 14:36:55 +0100
committerMax Kellermann <max@duempel.org>2015-02-06 14:36:55 +0100
commitd38034bb5c7bb58c01ce817fbeb394b178961a13 (patch)
tree06d613edb68a83f291c31403c564bb8955586e96
parentb3fe3e8b3de5794762f21000d5771b0491e8a041 (diff)
downloadmpd-d38034bb5c7bb58c01ce817fbeb394b178961a13.tar.gz
mpd-d38034bb5c7bb58c01ce817fbeb394b178961a13.tar.xz
mpd-d38034bb5c7bb58c01ce817fbeb394b178961a13.zip
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.
-rw-r--r--NEWS1
-rw-r--r--src/fs/io/FileOutputStream.cxx2
2 files changed, 3 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 22920348b..5ac89971e 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ ver 0.19.9 (not yet released)
* fix build failure with uClibc
* fix build failure on non-POSIX operating systems
* fix dependency issue on parallel Android build
+* fix database/state file saving on Windows
ver 0.19.8 (2015/01/14)
* input
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);
}