]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: reduce failure_fatal to bool to save space
authorVictor Julien <vjulien@oisf.net>
Wed, 12 Jul 2023 06:05:29 +0000 (08:05 +0200)
committerVictor Julien <vjulien@oisf.net>
Thu, 13 Jul 2023 04:49:26 +0000 (06:49 +0200)
src/detect-engine-loader.c
src/detect-engine.c
src/detect.h
src/reputation.c

index 217665b24a06be6160f7beee53b20e1c031878a0..4b66eefa80691c183b6061c9d008947d1b107278 100644 (file)
@@ -339,7 +339,7 @@ int SigLoadSignatures(DetectEngineCtx *de_ctx, char *sig_file, int sig_file_excl
         ret = ProcessSigFiles(de_ctx, sig_file, sig_stat, &good_sigs, &bad_sigs);
 
         if (ret != 0) {
-            if (de_ctx->failure_fatal == 1) {
+            if (de_ctx->failure_fatal) {
                 exit(EXIT_FAILURE);
             }
         }
index 83756018ca32b258c54eaea12fb0af8f4b7f4e80..111dab7f0dd89017e334490c6f02e61377ec85cd 100644 (file)
@@ -2479,9 +2479,11 @@ static DetectEngineCtx *DetectEngineCtxInitReal(enum DetectEngineType type, cons
         strlcpy(de_ctx->config_prefix, prefix, sizeof(de_ctx->config_prefix));
     }
 
-    if (ConfGetBool("engine.init-failure-fatal", (int *)&(de_ctx->failure_fatal)) != 1) {
+    int failure_fatal = 0;
+    if (ConfGetBool("engine.init-failure-fatal", (int *)&failure_fatal) != 1) {
         SCLogDebug("ConfGetBool could not load the value.");
     }
+    de_ctx->failure_fatal = (failure_fatal == 1);
 
     de_ctx->mpm_matcher = PatternMatchDefaultMatcher();
     de_ctx->spm_matcher = SinglePatternMatchDefaultMatcher();
index e462933c2c236e32b322a36b9c74489d7dff1195..dada307da23c8dd8bb245a88549df33c0f08ca23 100644 (file)
@@ -824,7 +824,7 @@ enum DetectEngineType
 
 /** \brief main detection engine ctx */
 typedef struct DetectEngineCtx_ {
-    int failure_fatal;
+    bool failure_fatal;
 
     int tenant_id;
 
index d10a3143c8fce2d0a02eff6b74a9af91dcdee9f2..7313012d173717e87333ba1e3dbd1a3adfe30646 100644 (file)
@@ -641,7 +641,7 @@ int SRepInit(DetectEngineCtx *de_ctx)
 
                 int r = SRepLoadFile(cidr_ctx, sfile);
                 if (r < 0){
-                    if (de_ctx->failure_fatal == 1) {
+                    if (de_ctx->failure_fatal) {
                         exit(EXIT_FAILURE);
                     }
                 }