- client: fix bug in writing daily xfer history file

svn path=/trunk/boinc/; revision=24341
This commit is contained in:
David Anderson 2011-10-06 17:39:13 +00:00
parent 115ca46730
commit 56492aaeac
3 changed files with 25 additions and 8 deletions

View File

@ -6863,7 +6863,7 @@ David 5 Oct
client/
pers_file_xfer.cpp
David 5 Oct
David 6 Oct
- GUI RPC: add get_daily_xfer_history() RPC for getting
the daily records of #bytes uploaded and downloaded
@ -6876,3 +6876,10 @@ David 5 Oct
gui_rpc_server_ops.cpp
net_stats.cpp,h
main.cpp
David 6 Oct
- client: fix bug in writing daily xfer history file
client/
main.cpp
net_stats.cpp

View File

@ -280,7 +280,7 @@ static int finalize() {
#ifdef USE_WINSOCK
if (WinsockCleanup()) {
log_message_error("Failed to cleanup the Windows Sockets interface");
log_message_error("WinSockCleanup() failed");
return ERR_IO;
}
#endif

View File

@ -378,7 +378,7 @@ int DAILY_XFER_HISTORY::write_xml(MIOFILE& out) {
dx.write(out);
}
int n = out.printf("</daily_xfers>\n");
if (n != 1) return ERR_FWRITE;
if (n <= 0) return ERR_FWRITE;
return 0;
}
@ -389,11 +389,21 @@ void DAILY_XFER_HISTORY::write_file() {
mf.init_file(f);
int retval = write_xml(mf);
fclose(f);
if (!retval) {
retval = boinc_rename(TEMP_FILE_NAME, DAILY_XFER_HISTORY_FILENAME);
if (!retval) {
dirty = false;
}
if (retval) {
msg_printf(0, MSG_INTERNAL_ERROR,
"failed to write xfer history: %s",
boincerror(retval)
);
return;
}
retval = boinc_rename(TEMP_FILE_NAME, DAILY_XFER_HISTORY_FILENAME);
if (retval) {
msg_printf(0, MSG_INTERNAL_ERROR,
"failed to rename xfer history file: %s",
boincerror(retval)
);
} else {
dirty = false;
}
}