From: Yu Watanabe Date: Fri, 25 Jul 2025 18:24:51 +0000 (+0900) Subject: install: skip later first_word() calls if one of earlier calls passes X-Git-Tag: v258-rc2~81^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c119eb0edcc422a2908dd2e6c5d678019f070dbd;p=thirdparty%2Fsystemd.git install: skip later first_word() calls if one of earlier calls passes Prompted by CID#1587764, that is false-positive. --- diff --git a/src/shared/install.c b/src/shared/install.c index 8fc087fb78c..3522af67eca 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -3350,8 +3350,7 @@ static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePreset if (strchr(COMMENTS, line[0])) continue; - parameter = first_word(line, "enable"); - if (parameter) { + if ((parameter = first_word(line, "enable"))) { char *unit_name; char **instances = NULL; @@ -3367,10 +3366,8 @@ static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePreset .action = PRESET_ENABLE, .instances = instances, }; - } - parameter = first_word(line, "disable"); - if (parameter) { + } else if ((parameter = first_word(line, "disable"))) { char *pattern; pattern = strdup(parameter); @@ -3381,10 +3378,8 @@ static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePreset .pattern = pattern, .action = PRESET_DISABLE, }; - } - parameter = first_word(line, "ignore"); - if (parameter) { + } else if ((parameter = first_word(line, "ignore"))) { char *pattern; pattern = strdup(parameter); @@ -3397,7 +3392,7 @@ static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePreset }; } - if (rule.action) { + if (rule.action != 0) { if (!GREEDY_REALLOC(ps.rules, ps.n_rules + 1)) return -ENOMEM;