mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
770ad616dd
commit
a84142fc4e
|
@ -23,7 +23,16 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static uint8_t error_in_progress = 0;
|
||||||
|
|
||||||
WEAK void error(const char* format, ...) {
|
WEAK void error(const char* format, ...) {
|
||||||
|
|
||||||
|
// Prevent recursion if error is called again
|
||||||
|
if (error_in_progress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
error_in_progress = 1;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
va_list arg;
|
va_list arg;
|
||||||
va_start(arg, format);
|
va_start(arg, format);
|
||||||
|
|
Loading…
Reference in New Issue