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

@ -79,6 +79,12 @@ public:
void PopLocation()
{ locations.pop_back(); }
// Signals that we're entering processing an error handler event.
void BeginErrorHandler() { ++in_error_handler; }
// Signals that we're done processing an error handler event.
void EndErrorHandler() { --in_error_handler; }
private:
void DoLog(const char* prefix, EventHandlerPtr event, FILE* out, Connection* conn, val_list* addl, bool location, bool time, const char* fmt, va_list ap);
@ -87,6 +93,7 @@ private:
int errors;
bool via_events;
int in_error_handler;
std::list<std::pair<const Location*, const Location*> > locations;
};