From f28b7bb5a552b82598c98f42bd35d1ee1cbab794 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 22 Apr 2009 13:32:29 +0200 Subject: [PATCH] dbus/dbus-sysdeps-win.c: use MoveFileEx, not unlink+rename, in _dbus_string_save_to_file (cherry picked from commit c31bb3c262db1e6e42ec1bc9a6e8063c625a7cb2) --- dbus/dbus-sysdeps-win.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 2aec554..7d9fc4a 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -2229,8 +2229,8 @@ _dbus_string_save_to_file (const DBusString *str, fd = -1; - if ((unlink (filename_c) == -1 && errno != ENOENT) || - rename (tmp_filename_c, filename_c) < 0) + /* Unlike rename(), MoveFileEx() can replace existing files */ + if (MoveFileExA (tmp_filename_c, filename_c, MOVEFILE_REPLACE_EXISTING) < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), "Could not rename %s to %s: %s", -- 2.7.4