]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pid1: fold load_configuration() into main()
authorFranck Bui <fbui@suse.com>
Mon, 27 Apr 2020 06:36:47 +0000 (08:36 +0200)
committerFranck Bui <fbui@suse.com>
Tue, 19 May 2020 13:48:54 +0000 (15:48 +0200)
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

index 4cb61af74500fbad883c433fff808dc0dc411a06..b60bbaf61f6dd6170d1e2916cbdfd2c4140bf8bd 100644 (file)
@@ -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)