Skip to content

Commit

Permalink
util/debug: exit is not thread safe
Browse files Browse the repository at this point in the history
The exit() function is not thread safe and triggers a warning from
clang tidy for all FatalError() and FatalErrorAtInit() calls.

This patch uses quick_exit instead to only flush the critical IO
and not call the static destructors (which are the non thread safe
part).
  • Loading branch information
regit committed Dec 27, 2024
1 parent e8ab4d3 commit e949001
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void SCLogErr(int x, const char *file, const char *func, const int line, const c
#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
Expand All @@ -515,7 +515,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)
Expand Down

0 comments on commit e949001

Please sign in to comment.