From: Karel Zak Date: Tue, 14 Oct 2025 10:59:05 +0000 (+0200) Subject: lib/config: fix file counter X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f44c01a77a95a38920740a3abb5713a537a0bac4;p=thirdparty%2Futil-linux.git lib/config: fix file counter We need to count only files in the final list, not in the temporary lists. Signed-off-by: Karel Zak --- diff --git a/lib/configs.c b/lib/configs.c index 940c3837a..34eec455a 100644 --- a/lib/configs.c +++ b/lib/configs.c @@ -283,7 +283,6 @@ int ul_configs_file_list(struct list_head *file_list, goto finish; } list_add_tail(&add_element->file_list, &etc_run_file_list); - counter++; } list_del(&run_element->file_list); } else { @@ -296,7 +295,6 @@ int ul_configs_file_list(struct list_head *file_list, goto finish; } list_add_tail(&add_element->file_list, &etc_run_file_list); - counter++; } /* taking the rest of /run */ @@ -308,7 +306,6 @@ int ul_configs_file_list(struct list_head *file_list, goto finish; } list_add_tail(&add_element->file_list, &etc_run_file_list); - counter++; } /* Merging etc_run list and var list in the correct order. Output: file_list diff --git a/tests/expected/misc/configs-combined b/tests/expected/misc/configs-combined index d0ab0edf6..9e1b57f04 100644 --- a/tests/expected/misc/configs-combined +++ b/tests/expected/misc/configs-combined @@ -1,4 +1,4 @@ -Found 6 configuration file(s): +Found 4 configuration file(s): @TESTDIR@/etc/proj/example.conf @TESTDIR@/usr/proj/example.conf.d/10-base.conf @TESTDIR@/run/proj/example.conf.d/20-override.conf diff --git a/tests/expected/misc/configs-dropin-etc b/tests/expected/misc/configs-dropin-etc index 0e567397b..a876fb9e8 100644 --- a/tests/expected/misc/configs-dropin-etc +++ b/tests/expected/misc/configs-dropin-etc @@ -1,3 +1,3 @@ -Found 4 configuration file(s): +Found 2 configuration file(s): @TESTDIR@/etc/proj/example.conf.d/10-first.conf @TESTDIR@/etc/proj/example.conf.d/20-second.conf diff --git a/tests/expected/misc/configs-masking b/tests/expected/misc/configs-masking index 4f06221e9..ad267849c 100644 --- a/tests/expected/misc/configs-masking +++ b/tests/expected/misc/configs-masking @@ -1,2 +1,2 @@ -Found 2 configuration file(s): +Found 1 configuration file(s): @TESTDIR@/etc/proj/example.conf.d/10-config.conf