diff options
author | Chris Wilson <chris+github@qwirx.com> | 2012-04-28 18:18:15 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2012-04-28 18:18:15 +0000 |
commit | 5818dd9c8233d1454a5f8284ba437ea2f77ee626 (patch) | |
tree | 21d2ae7c87476391be398050e46d4b6b6f4df300 /lib/server/makeprotocol.pl.in | |
parent | 4138b4d20c6e6f4b3ba101cf8b6182011075a3db (diff) |
Defend against exceptions during logging, e.g. CipherException if filename decrypt fails.
Diffstat (limited to 'lib/server/makeprotocol.pl.in')
-rwxr-xr-x | lib/server/makeprotocol.pl.in | 20 |
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); } |