From: Karel Zak Date: Wed, 15 Oct 2025 13:18:05 +0000 (+0200) Subject: lib/configs: simplify merge error checking X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7609cb258d4975e49b020860f8ebba6feb5f2354;p=thirdparty%2Futil-linux.git lib/configs: simplify merge error checking 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 --- diff --git a/lib/configs.c b/lib/configs.c index 87e17fa0c..aaf55d42d 100644 --- a/lib/configs.c +++ b/lib/configs.c @@ -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) */