diff --git a/configure.ac b/configure.ac index ca964d9039a0..0623de52446c 100644 --- a/configure.ac +++ b/configure.ac @@ -224,6 +224,11 @@ [], [ #include ]) + AC_CHECK_DECL([quick_exit], + AC_DEFINE([HAVE_QUICK_EXIT], [1], [Use quick_exit]), + [], [ + #include + ]) AC_CHECK_HEADERS([malloc.h]) AC_CHECK_DECL([malloc_trim], diff --git a/src/util-debug.h b/src/util-debug.h index cb22e9097389..4fba832ea652 100644 --- a/src/util-debug.h +++ b/src/util-debug.h @@ -499,10 +499,14 @@ void SCLogErr(int x, const char *file, const char *func, const int line, const c #endif /* DEBUG */ +#if !HAVE_QUICK_EXIT +#define quick_exit exit +#endif + #define FatalError(...) \ do { \ SCLogError(__VA_ARGS__); \ - exit(EXIT_FAILURE); \ + quick_exit(EXIT_FAILURE); \ } while (0) /** \brief Fatal error IF we're starting up, and configured to consider @@ -515,7 +519,7 @@ void SCLogErr(int x, const char *file, const char *func, const int line, const c (void)ConfGetBool("engine.init-failure-fatal", &init_errors_fatal); \ if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT)) { \ SCLogError(__VA_ARGS__); \ - exit(EXIT_FAILURE); \ + quick_exit(EXIT_FAILURE); \ } \ SCLogWarning(__VA_ARGS__); \ } while (0)