From ffe5c01eaaf4fd7acda2553e76ab42518c215312 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Mon, 27 Apr 2020 08:36:47 +0200 Subject: [PATCH] pid1: fold load_configuration() into main() That's reduce the number of functions dealing with configuration parsing/loading and should make the code simpler especially since this function was used only once. No functional change. --- src/core/main.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 4cb61af745..b60bbaf61f 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2257,29 +2257,6 @@ static int parse_configuration(const struct rlimit *saved_rlimit_nofile, return 0; } -static int load_configuration( - int argc, - char **argv, - const struct rlimit *saved_rlimit_nofile, - const struct rlimit *saved_rlimit_memlock, - const char **ret_error_message) { - int r; - - assert(saved_rlimit_nofile); - assert(saved_rlimit_memlock); - assert(ret_error_message); - - (void) parse_configuration(saved_rlimit_nofile, saved_rlimit_memlock); - - r = parse_argv(argc, argv); - if (r < 0) { - *ret_error_message = "Failed to parse commandline arguments"; - return r; - } - - return 0; -} - static int safety_checks(void) { if (getpid_cached() == 1 && @@ -2618,9 +2595,13 @@ int main(int argc, char *argv[]) { (void) reset_all_signal_handlers(); (void) ignore_signals(SIGNALS_IGNORE, -1); - r = load_configuration(argc, argv, &saved_rlimit_nofile, &saved_rlimit_memlock, &error_message); - if (r < 0) + (void) parse_configuration(&saved_rlimit_nofile, &saved_rlimit_memlock); + + r = parse_argv(argc, argv); + if (r < 0) { + error_message = "Failed to parse commandline arguments"; goto finish; + } r = safety_checks(); if (r < 0)