[Box Backup-commit] COMMIT r1030 - box/chris/merge/bin/bbackupd
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sat, 14 Oct 2006 15:50:33 +0100
Author: chris
Date: 2006-10-14 15:50:33 +0100 (Sat, 14 Oct 2006)
New Revision: 1030
Modified:
box/chris/merge/bin/bbackupd/BackupDaemon.cpp
Log:
* Catch invalid output from sync allow script and tell the user what it
was, to help them debug the problem (refs #3)
Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-10-14 14:47:06 UTC (rev 1029)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-10-14 14:50:33 UTC (rev 1030)
@@ -59,6 +59,7 @@
#include "BackupStoreFilenameClear.h"
#include "BackupClientInodeToIDMap.h"
#include "autogen_BackupProtocolClient.h"
+#include "autogen_ConversionException.h"
#include "BackupClientCryptoKeys.h"
#include "BannerText.h"
#include "BackupStoreFile.h"
@@ -934,8 +935,21 @@
}
else
{
- // How many seconds to wait?
- waitInSeconds = BoxConvert::Convert<int32_t, const std::string&>(line);
+ try
+ {
+ // How many seconds to wait?
+ waitInSeconds = BoxConvert::Convert<int32_t, const std::string&>(line);
+ }
+ catch(ConversionException &e)
+ {
+ ::syslog(LOG_ERR, "Invalid output "
+ "from SyncAllowScript '%s': "
+ "'%s'",
+ conf.GetKeyValue("SyncAllowScript").c_str(),
+ line.c_str());
+ throw;
+ }
+
::syslog(LOG_INFO, "Delaying sync by %d seconds (SyncAllowScript '%s')", waitInSeconds, conf.GetKeyValue("SyncAllowScript").c_str());
}
}