mirror of https://github.com/BOINC/boinc.git
wrapper: fix bug in reading checkpoint file; from Kevin Vinson
This commit is contained in:
parent
d9ecce24d4
commit
5f53fe3077
|
@ -970,17 +970,22 @@ void write_checkpoint(int ntasks_completed, double cpu, double rt) {
|
||||||
boinc_checkpoint_completed();
|
boinc_checkpoint_completed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read the checkpoint file;
|
||||||
|
// return nonzero if it's missing or bad format
|
||||||
|
//
|
||||||
int read_checkpoint(int& ntasks_completed, double& cpu, double& rt) {
|
int read_checkpoint(int& ntasks_completed, double& cpu, double& rt) {
|
||||||
int nt;
|
int nt;
|
||||||
double c, r;
|
double c, r;
|
||||||
|
|
||||||
ntasks_completed = 0;
|
ntasks_completed = 0;
|
||||||
cpu = 0;
|
cpu = 0;
|
||||||
|
rt = 0;
|
||||||
FILE* f = fopen(CHECKPOINT_FILENAME, "r");
|
FILE* f = fopen(CHECKPOINT_FILENAME, "r");
|
||||||
if (!f) return ERR_FOPEN;
|
if (!f) return ERR_FOPEN;
|
||||||
int n = fscanf(f, "%d %lf %lf", &nt, &c, &r);
|
int n = fscanf(f, "%d %lf %lf", &nt, &c, &r);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (n != 2) return 0;
|
if (n != 3) return -1;
|
||||||
|
|
||||||
ntasks_completed = nt;
|
ntasks_completed = nt;
|
||||||
cpu = c;
|
cpu = c;
|
||||||
rt = r;
|
rt = r;
|
||||||
|
@ -1025,8 +1030,7 @@ int main(int argc, char** argv) {
|
||||||
if (retval && !zip_filename.empty()) {
|
if (retval && !zip_filename.empty()) {
|
||||||
// this is the first time we've run.
|
// this is the first time we've run.
|
||||||
// If we're going to zip output files,
|
// If we're going to zip output files,
|
||||||
// make a list of files present at this point
|
// make a list of files present at this point so we can exclude them.
|
||||||
// so we can exclude them.
|
|
||||||
//
|
//
|
||||||
write_checkpoint(0, 0, 0);
|
write_checkpoint(0, 0, 0);
|
||||||
get_initial_file_list();
|
get_initial_file_list();
|
||||||
|
|
Loading…
Reference in New Issue