diff options
| author | Karel Zak <kzak@redhat.com> | 2025-10-15 15:18:05 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2025-10-15 15:18:05 +0200 |
| commit | 7609cb258d4975e49b020860f8ebba6feb5f2354 (patch) | |
| tree | 584543ae3cd36a86b66622838d244089888f5648 | |
| parent | dad16046185ab4d1d6e2603919acc7b67e6f032e (diff) | |
| download | util-linux-7609cb258d4975e49b020860f8ebba6feb5f2354.tar.gz | |
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 <kzak@redhat.com>
| -rw-r--r-- | lib/configs.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/configs.c b/lib/configs.c index 87e17fa0cc..aaf55d42d9 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) */ |
