From 5cb66db61d7a189fc52ea24ee4153ff350712d5c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 15 Sep 2010 23:25:23 +0000 Subject: [PATCH] - client (Win): use MoveFileEx() to rename file. More atomic than delete/rename. fixes #1010 svn path=/trunk/boinc/; revision=22364 --- checkin_notes | 7 +++++++ lib/filesys.cpp | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 341fdbf29c..b0d5d258c9 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6610,3 +6610,10 @@ David 15 Sept 2010 boinc_api.cpp,h graphics2_unix.cpp graphics2_win.cpp + +David 15 Sept 2010 + - client (Win): use MoveFileEx() to rename file. + More atomic than delete/rename. + fixes #1010 + lib/ + filesyst.cpp diff --git a/lib/filesys.cpp b/lib/filesys.cpp index 4bcd085fd6..4ef17a60f6 100644 --- a/lib/filesys.cpp +++ b/lib/filesys.cpp @@ -568,8 +568,7 @@ int boinc_copy(const char* orig, const char* newf) { static int boinc_rename_aux(const char* old, const char* newf) { #ifdef _WIN32 - boinc_delete_file(newf); - if (MoveFileA(old, newf)) return 0; + if (MoveFileEx(old, newf, MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH)) return 0; return GetLastError(); #else int retval = rename(old, newf);