]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-event: move debug logging before safe_fork()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 22 Oct 2018 09:21:42 +0000 (18:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 23 Oct 2018 19:46:48 +0000 (04:46 +0900)
This fixes the following journal layout issue:
```
Oct 22 15:26:02 systemd-udevd[348]: RUN '/usr/sbin/setregdomain' /usr/lib/udev/rules.d/85-regulatory.rules:5
Oct 22 15:26:02 [439]: Starting '/usr/sbin/setregdomain'
Oct 22 15:26:02 systemd-udevd[348]: Process '/usr/sbin/setregdomain' succeeded.
```

src/udev/udev-event.c

index 873f900349d53698bdb1eb200e9aae4553fa6ba5..1c4cb7fb7851cb0d854969495ffc07c151b84852 100644 (file)
@@ -737,6 +737,8 @@ int udev_event_spawn(struct udev_event *event,
                 free_and_replace(argv[0], program);
         }
 
+        log_debug("Starting '%s'", cmd);
+
         r = safe_fork("(spawn)", FORK_RESET_SIGNALS|FORK_LOG, &pid);
         if (r < 0)
                 return log_error_errno(r, "Failed to fork() to execute command '%s': %m", cmd);
@@ -745,8 +747,6 @@ int udev_event_spawn(struct udev_event *event,
                 outpipe[READ_END] = safe_close(outpipe[READ_END]);
                 errpipe[READ_END] = safe_close(errpipe[READ_END]);
 
-                log_debug("Starting '%s'", cmd);
-
                 spawn_exec(event, cmd, argv, udev_device_get_properties_envp(event->dev),
                            outpipe[WRITE_END], errpipe[WRITE_END]);