Prevent recursive call to error()

Only allow error to be called once. This prevents a loop where error()
calls exit() which in turn triggers another call to exit().
pull/4389/head
Russ Butler 2017-06-01 15:53:06 -05:00 committed by Russ Butler
parent 770ad616dd
commit a84142fc4e
1 changed files with 9 additions and 0 deletions

View File

@ -23,7 +23,16 @@
#include <stdio.h>
#endif
static uint8_t error_in_progress = 0;
WEAK void error(const char* format, ...) {
// Prevent recursion if error is called again
if (error_in_progress) {
return;
}
error_in_progress = 1;
#ifndef NDEBUG
va_list arg;
va_start(arg, format);