From 377f2d7e1e226407144b660c6c91e56828329d90 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 12 Jul 2023 08:05:29 +0200 Subject: [PATCH] detect: reduce failure_fatal to bool to save space --- src/detect-engine-loader.c | 2 +- src/detect-engine.c | 4 +++- src/detect.h | 2 +- src/reputation.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/detect-engine-loader.c b/src/detect-engine-loader.c index 217665b24a..4b66eefa80 100644 --- a/src/detect-engine-loader.c +++ b/src/detect-engine-loader.c @@ -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); } } diff --git a/src/detect-engine.c b/src/detect-engine.c index 83756018ca..111dab7f0d 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -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(); diff --git a/src/detect.h b/src/detect.h index e462933c2c..dada307da2 100644 --- a/src/detect.h +++ b/src/detect.h @@ -824,7 +824,7 @@ enum DetectEngineType /** \brief main detection engine ctx */ typedef struct DetectEngineCtx_ { - int failure_fatal; + bool failure_fatal; int tenant_id; diff --git a/src/reputation.c b/src/reputation.c index d10a3143c8..7313012d17 100644 --- a/src/reputation.c +++ b/src/reputation.c @@ -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); } }