chiark / gitweb /
net-util: call ioctl() only if necessary
[elogind.git] / src / udev / udevd.c
index 45ec3d681facf8045045a043bcdcc0a7453b62ff..559d33e78f86d10f362e7b7572d51f206ca06fdf 100644 (file)
@@ -779,10 +779,11 @@ static void handle_signal(struct udev *udev, int signo)
 
                                 if (WIFEXITED(status)) {
                                         if (WEXITSTATUS(status) != 0)
-                                                log_error("worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status));
+                                                log_error("worker [%u] exit with return code %i\n",
+                                                          pid, WEXITSTATUS(status));
                                 } else if (WIFSIGNALED(status)) {
                                         log_error("worker [%u] terminated by signal %i (%s)\n",
-                                            pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
+                                                  pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
                                 } else if (WIFSTOPPED(status)) {
                                         log_error("worker [%u] stopped\n", pid);
                                 } else if (WIFCONTINUED(status)) {
@@ -856,10 +857,15 @@ static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink)
  */
 static void kernel_cmdline_options(struct udev *udev)
 {
-        char *line, *w, *state;
+        _cleanup_free_ char *line = NULL;
+        char *w, *state;
         size_t l;
+        int r;
 
-        if (read_one_line_file("/proc/cmdline", &line) < 0)
+        r = proc_cmdline(&line);
+        if (r < 0)
+                log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
+        if (r <= 0)
                 return;
 
         FOREACH_WORD_QUOTED(w, l, line, state) {
@@ -889,8 +895,6 @@ static void kernel_cmdline_options(struct udev *udev)
 
                 free(s);
         }
-
-        free(line);
 }
 
 int main(int argc, char *argv[])
@@ -923,7 +927,10 @@ int main(int argc, char *argv[])
         log_set_target(LOG_TARGET_AUTO);
         log_parse_environment();
         log_open();
+
         udev_set_log_fn(udev, udev_main_log);
+        log_set_max_level(udev_get_log_priority(udev));
+
         log_debug("version %s\n", VERSION);
         label_init("/dev");