From a703f5390a9ce76dd9342ad0229690320d3d227c Mon Sep 17 00:00:00 2001 From: gombasg Date: Fri, 7 Jul 2006 13:59:01 +0000 Subject: [PATCH] Allow passing a NULL to DC_checkpointMade() since boinc_checkpoint_completed() is better be called even if the app does not support checkpointing git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@800 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/boinc/client.C | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/dcapi/boinc/client.C b/dcapi/boinc/client.C index 878a69feaa..66d1c44219 100644 --- a/dcapi/boinc/client.C +++ b/dcapi/boinc/client.C @@ -536,7 +536,19 @@ void DC_checkpointMade(const char *filename) if (!filename) { - DC_log(LOG_ERR, "%s: Missing file name", __func__); + /* No file name - reset the checkpoint logic */ + if (active_ckpt[0]) + unlink(active_ckpt); + active_ckpt[0] = '\0'; + + if (last_complete_ckpt) + { + unlink(last_complete_ckpt); + free(last_complete_ckpt); + last_complete_ckpt = NULL; + } + + boinc_checkpoint_completed(); return; } @@ -544,6 +556,7 @@ void DC_checkpointMade(const char *filename) { DC_log(LOG_ERR, "DC_checkpointMade: bad checkpoint file %s " "(expected %s)", filename, active_ckpt); + boinc_checkpoint_completed(); return; } @@ -557,10 +570,14 @@ void DC_checkpointMade(const char *filename) fclose(f); } - unlink(last_complete_ckpt); - free(last_complete_ckpt); + if (last_complete_ckpt) + { + unlink(last_complete_ckpt); + free(last_complete_ckpt); + } last_complete_ckpt = strdup(filename); - /* Prevent it to be deleted by DC_resolveFileName() */ + + /* Reset the active checkpoint */ active_ckpt[0] = '\0'; boinc_checkpoint_completed();