Skip to content

Commit

Permalink
- client: fix bug in reading reason for temporary exit
Browse files Browse the repository at this point in the history
- lib: fix a valgrind warning


svn path=/trunk/boinc/; revision=25499
  • Loading branch information
davidpanderson committed Mar 27, 2012
1 parent ea46132 commit 39f5dc7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion client/app_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 39f5dc7

Please sign in to comment.