diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-08-09 18:16:21 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-08-09 18:16:21 +0000 |
commit | 275ac0cf61a56b87cabe4441d9a54445e542a041 (patch) | |
tree | ac760e0407057b16f6143dcb48f521a0fc8de935 /bin/bbackupd | |
parent | d2c12caedda424456bf8f47ce385822d744eeede (diff) |
* bin/bbackupd/BackupDaemon.cpp
- Use the result of SerializeStoreObjectInfo, if we failed to serialise
(when no file existed) then no need to delete the file on the next run.
Diffstat (limited to 'bin/bbackupd')
-rw-r--r-- | bin/bbackupd/BackupDaemon.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index 8d6f9ee3..7ba683b0 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -504,8 +504,8 @@ void BackupDaemon::Run2() BackupClientContext::ClientStoreMarker_NotKnown; // haven't contacted the store yet - bool deserialised = DeserializeStoreObjectInfo(clientStoreMarker, - lastSyncTime, nextSyncTime); + bool deleteStoreObjectInfoFile = DeserializeStoreObjectInfo( + clientStoreMarker, lastSyncTime, nextSyncTime); // -------------------------------------------------------------------------------------------- @@ -611,7 +611,8 @@ void BackupDaemon::Run2() // Delete the serialised store object file, // so that we don't try to reload it after a // partially completed backup - if(deserialised && !DeleteStoreObjectInfo()) + if(deleteStoreObjectInfoFile && + !DeleteStoreObjectInfo()) { ::syslog(LOG_ERR, "Failed to delete the " "StoreObjectInfoFile, backup cannot " @@ -621,6 +622,11 @@ void BackupDaemon::Run2() ::sleep(60); continue; } + + // In case the backup throws an exception, + // we should not try to delete the store info + // object file again. + deleteStoreObjectInfoFile = false; // Do sync bool errorOccurred = false; @@ -729,8 +735,14 @@ void BackupDaemon::Run2() // -------------------------------------------------------------------------------------------- - // We had a successful backup, save the store info - SerializeStoreObjectInfo(clientStoreMarker, lastSyncTime, nextSyncTime); + // We had a successful backup, save the store + // info. If we save successfully, we must + // delete the file next time we start a backup + + deleteStoreObjectInfoFile = + SerializeStoreObjectInfo( + clientStoreMarker, + lastSyncTime, nextSyncTime); // -------------------------------------------------------------------------------------------- } |