Avoiding infinite loops when an error message handlers triggers errors

itself.

If an error is triggered inside one of the reporter_* handlers, the
message about that will now fall back to stderr.
This commit is contained in:
Robin Sommer 2011-07-01 10:04:27 -07:00
parent 66e2c3b623
commit fb6a8cec19
16 changed files with 94 additions and 11 deletions

View file

@ -25,6 +25,7 @@ Reporter::Reporter()
{
errors = 0;
via_events = false;
in_error_handler = 0;
openlog("bro", 0, LOG_LOCAL5);
}
@ -246,7 +247,7 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Conne
FatalError("out of memory in Reporter");
}
if ( event && via_events )
if ( event && via_events && ! in_error_handler )
{
val_list* vl = new val_list;
@ -304,8 +305,6 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Conne
fprintf(out, s.c_str());
}
if ( alloced )
free(alloced);
}