- client: fix bug in reading reason for temporary exit

- lib: fix a valgrind warning


svn path=/trunk/boinc/; revision=25499
This commit is contained in:
David Anderson 2012-03-27 20:52:25 +00:00
parent ea4613214a
commit 39f5dc7e58
3 changed files with 12 additions and 2 deletions

View File

@ -3098,3 +3098,12 @@ David 27 Mar 2012
boinc_api.h
client/
app_control.cpp
David 27 Mar 2012
- client: fix bug in reading reason for temporary exit
- lib: fix a valgrind warning
lib/
parse.cpp
client/
app_control.cpp

View File

@ -531,9 +531,9 @@ bool ACTIVE_TASK::temporary_exit_file_present(double& x, char* buf) {
sprintf(path, "%s/%s", slot_dir, TEMPORARY_EXIT_FILE);
FILE* f = fopen(path, "r");
if (!f) return false;
strcpy(buf, "");
int y;
int n = fscanf(f, "%d", &y);
fclose(f);
if (n != 1 || y < 0 || y > 86400) {
x = 300;
} else {
@ -542,6 +542,7 @@ bool ACTIVE_TASK::temporary_exit_file_present(double& x, char* buf) {
fgets(buf, 256, f); // read the \n
fgets(buf, 256, f);
strip_whitespace(buf);
fclose(f);
return true;
}

View File

@ -401,7 +401,7 @@ void xml_escape(const char* in, char* out, int len) {
// Note: XML unescaping never increases string length
//
void xml_unescape(string& in) {
int n = (int)in.size()+1;
int n = (int)in.size()+1+16; // +16 avoids valgrind warnings
char* buf = (char*)malloc(n);
strcpy(buf, in.c_str());
xml_unescape(buf);