From 72a4ae4fe88a2915edba61b123a17b70226dbcbd Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Fri, 24 Jan 2003 00:40:00 +0000 Subject: [PATCH] file delete fix svn path=/trunk/boinc/; revision=827 --- api/boinc_api.C | 7 ++++++- api/boinc_api.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index dace2c51a1..8ccc92ca75 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -622,7 +622,7 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) { } int write_fraction_done_file(double pct, double cpu, double checkpoint_cpu) { - FILE* f = fopen(FRACTION_DONE_FILE, "w"); + FILE* f = fopen(FRACTION_DONE_TEMP_FILE, "w"); if (!f) return -1; @@ -637,6 +637,11 @@ int write_fraction_done_file(double pct, double cpu, double checkpoint_cpu) { ); fclose(f); +#ifdef _WIN32 + unlink(FRACTION_DONE_FILE); +#endif + rename(FRACTION_DONE_TEMP_FILE, FRACTION_DONE_FILE); + return 0; } diff --git a/api/boinc_api.h b/api/boinc_api.h index d4f0b73adb..33aefdabae 100755 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -89,6 +89,7 @@ int parse_suspend_quit_file(FILE* f, bool& suspend, bool& quit); #define GRAPHICS_DATA_FILE "graphics.xml" #define FD_INIT_FILE "fd_init.xml" #define FRACTION_DONE_FILE "fraction_done.xml" +#define FRACTION_DONE_TEMP_FILE "fraction_done.tmp" #define SUSPEND_QUIT_FILE "suspend.xml" #define STDERR_FILE "stderr.txt"