[Box Backup-commit] COMMIT r3100 - box/trunk/lib/server

subversion at boxbackup.org subversion at boxbackup.org
Sat Apr 28 19:18:15 BST 2012


Author: chris
Date: 2012-04-28 19:18:15 +0100 (Sat, 28 Apr 2012)
New Revision: 3100

Modified:
   box/trunk/lib/server/makeprotocol.pl.in
Log:
Defend against exceptions during logging, e.g. CipherException if filename decrypt fails.


Modified: box/trunk/lib/server/makeprotocol.pl.in
===================================================================
--- box/trunk/lib/server/makeprotocol.pl.in	2012-04-28 18:13:47 UTC (rev 3099)
+++ box/trunk/lib/server/makeprotocol.pl.in	2012-04-28 18:18:15 UTC (rev 3100)
@@ -469,12 +469,28 @@
 	print CPP <<__E;
 void $cmd_class\::LogSysLog(const char *Action) const
 {
-	BOX_TRACE($log);
+	try
+	{
+		BOX_TRACE($log);
+	}
+	catch(std::exception &e)
+	{
+		BOX_WARNING("Failed to log command: " << Action << ": " <<
+			e.what());
+	}
 }
 void $cmd_class\::LogFile(const char *Action, FILE *File) const
 {
 	std::ostringstream oss;
-	oss << $log;
+	try
+	{
+		oss << $log;
+	}
+	catch(std::exception &e)
+	{
+		oss << "Failed to log command: " << Action << ": " <<
+			e.what();
+	}
 	::fprintf(File, "%s\\n", oss.str().c_str());
 	::fflush(File);
 }




More information about the Boxbackup-commit mailing list