mirror of https://github.com/BOINC/boinc.git
parent
42c02adf5a
commit
158510e046
|
@ -40,13 +40,11 @@ int do_checkpoint(MFILE& mf, int filenum, int nchars ) {
|
|||
|
||||
fprintf(stderr, "APP: concat_slow checkpointing\n");
|
||||
|
||||
// hopefully atomic part starts here
|
||||
retval = mf.flush();
|
||||
if (retval) return retval;
|
||||
boinc_resolve_filename( CHECKPOINT_FILE, res_name2 );
|
||||
retval = rename(resolved_name, res_name2);
|
||||
retval = boinc_rename(resolved_name, res_name2);
|
||||
if (retval) return retval;
|
||||
// hopefully atomic part ends here
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ int do_checkpoint(MFILE& mf, int nchars) {
|
|||
retval = mf.flush();
|
||||
if (retval) return retval;
|
||||
boinc_resolve_filename( CHECKPOINT_FILE, res_name2 );
|
||||
retval = rename(resolved_name, res_name2);
|
||||
retval = boinc_rename(resolved_name, res_name2);
|
||||
if (retval) return retval;
|
||||
// hopefully atomic part ends here
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ int do_checkpoint(MFILE& mf, int nchars) {
|
|||
retval = mf.flush();
|
||||
if (retval) return retval;
|
||||
boinc_resolve_filename( CHECKPOINT_FILE, res_name2 );
|
||||
retval = rename(resolved_name, res_name2);
|
||||
retval = boinc_rename(resolved_name, res_name2);
|
||||
if (retval) return retval;
|
||||
// hopefully atomic part ends here
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ int CLIENT_STATE::write_state_file() {
|
|||
);
|
||||
fprintf(f, "</client_state>\n");
|
||||
fclose(f);
|
||||
retval = rename(STATE_FILE_TEMP, STATE_FILE_NAME);
|
||||
retval = boinc_rename(STATE_FILE_TEMP, STATE_FILE_NAME);
|
||||
if (log_flags.state_debug) {
|
||||
printf("Done writing state file\n");
|
||||
}
|
||||
|
@ -393,9 +393,9 @@ int CLIENT_STATE::write_state_file() {
|
|||
int CLIENT_STATE::write_state_file_if_needed() {
|
||||
int retval;
|
||||
if (client_state_dirty) {
|
||||
client_state_dirty = false;
|
||||
retval = write_state_file();
|
||||
if (retval) return retval;
|
||||
client_state_dirty = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -366,8 +366,8 @@ void CLIENT_STATE::handle_scheduler_reply(
|
|||
fclose(f);
|
||||
if (new_prefs->looks_reasonable(*project)) {
|
||||
make_prefs_backup_name(*prefs, prefs_backup);
|
||||
rename(PREFS_FILE_NAME, prefs_backup);
|
||||
rename(PREFS_TEMP_FILE_NAME, PREFS_FILE_NAME);
|
||||
boinc_rename(PREFS_FILE_NAME, prefs_backup);
|
||||
boinc_rename(PREFS_TEMP_FILE_NAME, PREFS_FILE_NAME);
|
||||
for (i=0; i<new_prefs->projects.size(); i++) {
|
||||
pp = new_prefs->projects[i];
|
||||
sp = lookup_project(pp->master_url);
|
||||
|
|
|
@ -254,3 +254,10 @@ double dir_size(char* dirpath) {
|
|||
dir_close(dirp);
|
||||
return cur_size;
|
||||
}
|
||||
|
||||
int boinc_rename(char* old, char* newf) {
|
||||
#ifdef _WIN32
|
||||
unlink(newf);
|
||||
#endif
|
||||
return rename(old, newf);
|
||||
}
|
||||
|
|
|
@ -38,3 +38,4 @@ extern int file_size(char*, int&);
|
|||
extern int boinc_link(char *existing, char *new_link);
|
||||
extern int clean_out_dir(char*);
|
||||
extern double dir_size(char* dirpath);
|
||||
extern int boinc_rename(char* old, char* newf);
|
||||
|
|
Loading…
Reference in New Issue