Client: Rework write_state_file logic to always retry on error, suppress intermediate warnings

svn path=/trunk/boinc/; revision=14894
This commit is contained in:
Charlie Fenton 2008-03-11 13:00:08 +00:00
parent b5e838b00e
commit 71e7aca1dc
1 changed files with 6 additions and 6 deletions

View File

@ -466,7 +466,7 @@ int CLIENT_STATE::parse_state_file() {
//
int CLIENT_STATE::write_state_file() {
MFILE mf;
int retval, ret1, ret2, attempt;
int retval, ret1=0, ret2=0, attempt;
#ifdef _WIN32
char win_error_msg[4096];
#endif
@ -563,7 +563,7 @@ int CLIENT_STATE::write_state_file() {
);
}
if (!retval) return 0;
if ((attempt == MAX_STATE_FILE_WRITE_ATTEMPTS) || log_flags.state_debug) {
if ((attempt == MAX_STATE_FILE_WRITE_ATTEMPTS) || log_flags.state_debug) {
#ifdef _WIN32
if (retval == ERROR_ACCESS_DENIED) {
msg_printf(0, MSG_USER_ERROR,
@ -585,10 +585,10 @@ int CLIENT_STATE::write_state_file() {
system("ls -al /Library/Application\\ Support/BOINC\\ Data/client*.*");
}
#else
msg_printf(0, MSG_USER_ERROR,
"Can't rename %s to %s; check file and directory permissions",
STATE_FILE_NEXT, STATE_FILE_NAME
);
msg_printf(0, MSG_USER_ERROR,
"Can't rename %s to %s; check file and directory permissions",
STATE_FILE_NEXT, STATE_FILE_NAME
);
#endif
}
}