Use _exit() in Reporter::FatalError

Using exit() here may generally not work well since:

* That will result in calling global destructors

* We have global state that we potentially modify at run-time and
  are in the middle of modiying at the time the FatalError occurs.
  E.g. out-of-memory is one situation where it's likely we could
  call the dtor of an object in which operation on it's internal
  state is no longer consistent/safe.
This commit is contained in:
Jon Siwek 2019-08-12 14:13:46 -07:00
parent 31d30bb47e
commit 41882263db

View file

@ -2,6 +2,7 @@
// See the file "COPYING" in the main distribution directory for copyright.
//
#include <unistd.h>
#include <syslog.h>
#include "zeek-config.h"
@ -117,7 +118,9 @@ void Reporter::FatalError(const char* fmt, ...)
va_end(ap);
set_processing_status("TERMINATED", "fatal_error");
exit(1);
fflush(stderr);
fflush(stdout);
_exit(1);
}
void Reporter::FatalErrorWithCore(const char* fmt, ...)