]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/configs: simplify merge error checking
authorKarel Zak <kzak@redhat.com>
Wed, 15 Oct 2025 13:18:05 +0000 (15:18 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 15 Oct 2025 13:18:05 +0000 (15:18 +0200)
Combine the three config_merge_list() calls into a single
conditional statement to reduce repetitive error checking.
The calls are short-circuited on first failure.

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/configs.c

index 87e17fa0cc3537568be9db6ce8742a739ef3fbc1..aaf55d42d9eb2c7a88fc53e8e01a173be105cc10 100644 (file)
@@ -273,16 +273,9 @@ int ul_configs_file_list(struct list_head *file_list,
 #endif
 
        /* Merge drop-in directories in priority order (high to low) */
-       ret = config_merge_list(file_list, &etc_list);
-       if (ret < 0)
-               goto finish;
-
-       ret = config_merge_list(file_list, &run_list);
-       if (ret < 0)
-               goto finish;
-
-       ret = config_merge_list(file_list, &usr_list);
-       if (ret < 0)
+       if ((ret = config_merge_list(file_list, &etc_list)) < 0 ||
+           (ret = config_merge_list(file_list, &run_list)) < 0 ||
+           (ret = config_merge_list(file_list, &usr_list)) < 0)
                goto finish;
 
        /* Add main config file at the beginning (highest priority) */