]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-debug: fix unchecked ConfGetBool call
authorJuliana Fajardini <jufajardini@gmail.com>
Tue, 10 Aug 2021 14:57:48 +0000 (15:57 +0100)
committerJuliana Fajardini <jufajardini@gmail.com>
Tue, 10 Aug 2021 14:57:48 +0000 (15:57 +0100)
src/util-debug.h

index 8d92d8bf8931f8bbdef1341cf07ceae5a1d6330b..9c93b5ce5150ab19dd79042652788dc2e6b27d10 100644 (file)
@@ -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
  * 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
  *         errors to be fatal errors */
 #if !defined(__clang_analyzer__)
-#define FatalErrorOnInit(x, ...) do {                                       \
-    SC_ATOMIC_EXTERN(unsigned int, engine_stage);                           \
-    int init_errors_fatal = 0;                                              \
-    ConfGetBool("engine.init-failure-fatal", &init_errors_fatal);           \
-    if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT))\
-    {                                                                       \
-        SCLogError(x, __VA_ARGS__);                                         \
-        exit(EXIT_FAILURE);                                                 \
-    }                                                                       \
-    SCLogWarning(x, __VA_ARGS__);                                           \
-} while(0)
+#define FatalErrorOnInit(x, ...)                                                                   \
+    do {                                                                                           \
+        SC_ATOMIC_EXTERN(unsigned int, engine_stage);                                              \
+        int init_errors_fatal = 0;                                                                 \
+        (void)ConfGetBool("engine.init-failure-fatal", &init_errors_fatal);                        \
+        if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT)) {                 \
+            SCLogError(x, __VA_ARGS__);                                                            \
+            exit(EXIT_FAILURE);                                                                    \
+        }                                                                                          \
+        SCLogWarning(x, __VA_ARGS__);                                                              \
+    } while (0)
 /* make it simpler for scan-build */
 #else
 #define FatalErrorOnInit(x, ...) FatalError(x, __VA_ARGS__)