util-debug: fix unchecked ConfGetBool call

pull/6290/head
Juliana Fajardini 4 years ago
parent 9d24a53c53
commit 09ea412614

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2010 Open Information Security Foundation /* Copyright (C) 2007-2021 Open Information Security Foundation
* *
* You can copy, redistribute or modify this Program under the terms of * You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free * the GNU General Public License version 2 as published by the Free
@ -537,17 +537,17 @@ void SCLogErr(int x, const char *file, const char *func, const int line,
/** \brief Fatal error IF we're starting up, and configured to consider /** \brief Fatal error IF we're starting up, and configured to consider
* errors to be fatal errors */ * errors to be fatal errors */
#if !defined(__clang_analyzer__) #if !defined(__clang_analyzer__)
#define FatalErrorOnInit(x, ...) do { \ #define FatalErrorOnInit(x, ...) \
SC_ATOMIC_EXTERN(unsigned int, engine_stage); \ do { \
int init_errors_fatal = 0; \ SC_ATOMIC_EXTERN(unsigned int, engine_stage); \
ConfGetBool("engine.init-failure-fatal", &init_errors_fatal); \ int init_errors_fatal = 0; \
if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT))\ (void)ConfGetBool("engine.init-failure-fatal", &init_errors_fatal); \
{ \ if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT)) { \
SCLogError(x, __VA_ARGS__); \ SCLogError(x, __VA_ARGS__); \
exit(EXIT_FAILURE); \ exit(EXIT_FAILURE); \
} \ } \
SCLogWarning(x, __VA_ARGS__); \ SCLogWarning(x, __VA_ARGS__); \
} while(0) } while (0)
/* make it simpler for scan-build */ /* make it simpler for scan-build */
#else #else
#define FatalErrorOnInit(x, ...) FatalError(x, __VA_ARGS__) #define FatalErrorOnInit(x, ...) FatalError(x, __VA_ARGS__)

Loading…
Cancel
Save