mirror of https://github.com/BOINC/boinc.git
- 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:
parent
ea4613214a
commit
39f5dc7e58
|
@ -3098,3 +3098,12 @@ David 27 Mar 2012
|
||||||
boinc_api.h
|
boinc_api.h
|
||||||
client/
|
client/
|
||||||
app_control.cpp
|
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
|
||||||
|
|
|
@ -531,9 +531,9 @@ bool ACTIVE_TASK::temporary_exit_file_present(double& x, char* buf) {
|
||||||
sprintf(path, "%s/%s", slot_dir, TEMPORARY_EXIT_FILE);
|
sprintf(path, "%s/%s", slot_dir, TEMPORARY_EXIT_FILE);
|
||||||
FILE* f = fopen(path, "r");
|
FILE* f = fopen(path, "r");
|
||||||
if (!f) return false;
|
if (!f) return false;
|
||||||
|
strcpy(buf, "");
|
||||||
int y;
|
int y;
|
||||||
int n = fscanf(f, "%d", &y);
|
int n = fscanf(f, "%d", &y);
|
||||||
fclose(f);
|
|
||||||
if (n != 1 || y < 0 || y > 86400) {
|
if (n != 1 || y < 0 || y > 86400) {
|
||||||
x = 300;
|
x = 300;
|
||||||
} else {
|
} 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); // read the \n
|
||||||
fgets(buf, 256, f);
|
fgets(buf, 256, f);
|
||||||
strip_whitespace(buf);
|
strip_whitespace(buf);
|
||||||
|
fclose(f);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ void xml_escape(const char* in, char* out, int len) {
|
||||||
// Note: XML unescaping never increases string length
|
// Note: XML unescaping never increases string length
|
||||||
//
|
//
|
||||||
void xml_unescape(string& in) {
|
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);
|
char* buf = (char*)malloc(n);
|
||||||
strcpy(buf, in.c_str());
|
strcpy(buf, in.c_str());
|
||||||
xml_unescape(buf);
|
xml_unescape(buf);
|
||||||
|
|
Loading…
Reference in New Issue