]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: Parse logging environment earlier
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 18 Apr 2023 11:15:20 +0000 (13:15 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 20 Apr 2023 11:43:37 +0000 (13:43 +0200)
Let's make sure we parse the logging environment ASAP so that the
options apply to more code. e.g. to allow debugging kmod-setup.c
for example.

src/core/main.c

index b627916a2598e09506e5425ee20bcde862384448..932ea64e4578d28132f098e9d1bf18bded501534 100644 (file)
@@ -2798,12 +2798,18 @@ int main(int argc, char *argv[]) {
                                         error_message = "Failed to mount early API filesystems";
                                         goto finish;
                                 }
+                        }
+
+                        /* We might have just mounted /proc, so let's try to parse the kernel
+                         * command line log arguments immediately. */
+                        log_parse_environment();
 
-                                /* Let's open the log backend a second time, in case the first time didn't
-                                 * work. Quite possibly we have mounted /dev just now, so /dev/kmsg became
-                                 * available, and it previously wasn't. */
-                                log_open();
+                        /* Let's open the log backend a second time, in case the first time didn't
+                         * work. Quite possibly we have mounted /dev just now, so /dev/kmsg became
+                         * available, and it previously wasn't. */
+                        log_open();
 
+                        if (!skip_setup) {
                                 disable_printk_ratelimit();
 
                                 r = initialize_security(