summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2012-04-28 18:18:15 +0000
committerChris Wilson <chris+github@qwirx.com>2012-04-28 18:18:15 +0000
commit5818dd9c8233d1454a5f8284ba437ea2f77ee626 (patch)
tree21d2ae7c87476391be398050e46d4b6b6f4df300 /lib
parent4138b4d20c6e6f4b3ba101cf8b6182011075a3db (diff)
Defend against exceptions during logging, e.g. CipherException if filename decrypt fails.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/server/makeprotocol.pl.in20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/server/makeprotocol.pl.in b/lib/server/makeprotocol.pl.in
index 95dd84fd..27a82959 100755
--- a/lib/server/makeprotocol.pl.in
+++ b/lib/server/makeprotocol.pl.in
@@ -469,12 +469,28 @@ __E
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);
}