[Box Backup-commit] COMMIT r1206 - box/trunk/bin/bbackupd

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Dec 14 23:01:45 GMT 2006


Author: chris
Date: 2006-12-14 23:01:45 +0000 (Thu, 14 Dec 2006)
New Revision: 1206

Modified:
   box/trunk/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. (merges [1030])


Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.cpp	2006-12-14 22:59:46 UTC (rev 1205)
+++ box/trunk/bin/bbackupd/BackupDaemon.cpp	2006-12-14 23:01:45 UTC (rev 1206)
@@ -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"
@@ -933,8 +934,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());
 			}
 		}




More information about the Boxbackup-commit mailing list