From f328d24d015a4b1879cadfaad93266b5530c700d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 23 Feb 2025 04:29:56 +0100 Subject: [PATCH] Fix possible overflow in return value Found by Coverity Scan Signed-off-by: Joachim Wiberg --- src/conf.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/conf.c b/src/conf.c index be2ecb9b..d90beb3b 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1579,25 +1579,26 @@ int conf_monitor(void) * have or not have symlinks in place. We need to monitor for * changes to either symlink or target. */ - rc += iwatch_add(&iw_conf, finit_rcsd, IN_ONLYDIR); + rc |= iwatch_add(&iw_conf, finit_rcsd, IN_ONLYDIR); snprintf(path, sizeof(path), "%s/available/", finit_rcsd); - rc += iwatch_add(&iw_conf, path, IN_ONLYDIR | IN_DONT_FOLLOW); + rc |= iwatch_add(&iw_conf, path, IN_ONLYDIR | IN_DONT_FOLLOW); snprintf(path, sizeof(path), "%s/enabled/", finit_rcsd); - rc += iwatch_add(&iw_conf, path, IN_ONLYDIR | IN_DONT_FOLLOW); - rc += iwatch_add(&iw_conf, finit_conf, 0); + rc |= iwatch_add(&iw_conf, path, IN_ONLYDIR | IN_DONT_FOLLOW); + rc |= iwatch_add(&iw_conf, finit_conf, 0); /* * Systems with /etc/default, /etc/conf.d, or similar, can also * monitor changes in env files sourced by .conf files (above) * define your own with --with-sysconfig=/path/to/envfiles */ - rc += iwatch_add(&iw_conf, "/etc/default/", IN_ONLYDIR); - rc += iwatch_add(&iw_conf, "/etc/conf.d/", IN_ONLYDIR); + rc |= iwatch_add(&iw_conf, "/etc/default/", IN_ONLYDIR); + rc |= iwatch_add(&iw_conf, "/etc/conf.d/", IN_ONLYDIR); #ifdef FINIT_SYSCONFIG - rc += iwatch_add(&iw_conf, FINIT_SYSCONFIG, IN_ONLYDIR); + rc |= iwatch_add(&iw_conf, FINIT_SYSCONFIG, IN_ONLYDIR); #endif + rc |= conf_reload(); - return rc + conf_reload(); + return rc; } /*