file delete fix

svn path=/trunk/boinc/; revision=827
This commit is contained in:
Eric Heien 2003-01-24 00:40:00 +00:00
parent e7363cc6fc
commit 72a4ae4fe8
2 changed files with 7 additions and 1 deletions

View File

@ -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) { 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) if (!f)
return -1; return -1;
@ -637,6 +637,11 @@ int write_fraction_done_file(double pct, double cpu, double checkpoint_cpu) {
); );
fclose(f); fclose(f);
#ifdef _WIN32
unlink(FRACTION_DONE_FILE);
#endif
rename(FRACTION_DONE_TEMP_FILE, FRACTION_DONE_FILE);
return 0; return 0;
} }

View File

@ -89,6 +89,7 @@ int parse_suspend_quit_file(FILE* f, bool& suspend, bool& quit);
#define GRAPHICS_DATA_FILE "graphics.xml" #define GRAPHICS_DATA_FILE "graphics.xml"
#define FD_INIT_FILE "fd_init.xml" #define FD_INIT_FILE "fd_init.xml"
#define FRACTION_DONE_FILE "fraction_done.xml" #define FRACTION_DONE_FILE "fraction_done.xml"
#define FRACTION_DONE_TEMP_FILE "fraction_done.tmp"
#define SUSPEND_QUIT_FILE "suspend.xml" #define SUSPEND_QUIT_FILE "suspend.xml"
#define STDERR_FILE "stderr.txt" #define STDERR_FILE "stderr.txt"