diff options
author | Ben Summers <ben@fluffy.co.uk> | 2006-03-19 10:08:56 +0000 |
---|---|---|
committer | Ben Summers <ben@fluffy.co.uk> | 2006-03-19 10:08:56 +0000 |
commit | f38da1d0a58251e89ae24723c8217b2c2042dfbc (patch) | |
tree | 0c7821ca7eafa0f721f0b1a7f63934ddc7c3f333 | |
parent | 3de317a4d8dfa49a783a3dd1c34145c754599823 (diff) |
Prevent runaway behaviour when the StoreObjectInfo file doesn't exist when it's expected to exist. Not a fix to the underlying problem.
-rw-r--r-- | bin/bbackupd/BackupDaemon.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index 3152d82d..ebf5a1ea 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -616,6 +616,9 @@ void BackupDaemon::Run2() ::syslog(LOG_ERR, "Failed to delete the " "StoreObjectInfoFile, backup cannot " "continue safely."); + // prevent runaway process where the logs fill up -- without this + // the log message will be emitted in a tight loop. + ::sleep(60); continue; } @@ -2417,14 +2420,25 @@ bool BackupDaemon::DeleteStoreObjectInfo() const return false; } - std::string StoreObjectInfoFile = - GetConfiguration().GetKeyValue("StoreObjectInfoFile"); + std::string storeObjectInfoFile(GetConfiguration().GetKeyValue("StoreObjectInfoFile")); + + // Check to see if the file exists + if(!FileExists(storeObjectInfoFile.c_str())) + { + // File doesn't exist -- so can't be deleted. But something isn't quite right, so log a message + ::syslog(LOG_ERR, "Expected to be able to delete " + "store object info file '%s', but the file did not exist.", + storeObjectInfoFile.c_str()); + // Return true to stop things going around in a loop + return true; + } - if (::unlink(StoreObjectInfoFile.c_str()) != 0) + // Actually delete it + if(::unlink(storeObjectInfoFile.c_str()) != 0) { ::syslog(LOG_ERR, "Failed to delete the old " "store object info file '%s': %s", - StoreObjectInfoFile.c_str(), strerror(errno)); + storeObjectInfoFile.c_str(), strerror(errno)); return false; } |