]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/config: fix file counter
authorKarel Zak <kzak@redhat.com>
Tue, 14 Oct 2025 10:59:05 +0000 (12:59 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Oct 2025 11:22:05 +0000 (13:22 +0200)
We need to count only files in the final list, not in the temporary
lists.

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/configs.c
tests/expected/misc/configs-combined
tests/expected/misc/configs-dropin-etc
tests/expected/misc/configs-masking

index 940c3837a91886529d7e1dc24a688736490cc4f1..34eec455a49a146ded3b235486cce8ba52ef5b1c 100644 (file)
@@ -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
index d0ab0edf649d8b09344a27ea5792662d3eb4caed..9e1b57f045a3c859b30ff0980b1cddf2f4b3f154 100644 (file)
@@ -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
index 0e567397b8844c6d29f5c20956ce8f94624fa380..a876fb9e8e1020550f25d43fcfe2f901ce16ddec 100644 (file)
@@ -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
index 4f06221e9a325e9bb1098d8947115691b006b15d..ad267849c4e137930ea49b1117b21f3cb0d621fa 100644 (file)
@@ -1,2 +1,2 @@
-Found 2 configuration file(s):
+Found 1 configuration file(s):
   @TESTDIR@/etc/proj/example.conf.d/10-config.conf