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

@ -39,6 +39,11 @@ public:
void SetUsed() { used = true; }
bool Used() { return used; }
// Handlers marked as error handlers will not be called recursively to
// avoid infinite loops if they trigger a similar error themselves.
void SetErrorHandler() { error_handler = true; }
bool ErrorHandler() { return error_handler; }
const char* Group() { return group; }
void SetGroup(const char* arg_group)
{ group = copy_string(arg_group); }
@ -57,6 +62,7 @@ private:
FuncType* type;
bool used; // this handler is indeed used somewhere
bool enabled;
bool error_handler; // this handler reports error messages.
declare(List, SourceID);
typedef List(SourceID) receiver_list;