chiark / gitweb /
journalctl: Unify boot id lookup into common function get_boots
[elogind.git] / src / udev / udevd.c
index cd517931d342f8599bf42d9e098915bbc61857f7..2e6c71352f8776f03c717bdc8af9cb30f6bea679 100644 (file)
@@ -1048,17 +1048,23 @@ static int parse_argv(int argc, char *argv[]) {
                         arg_daemonize = true;
                         break;
                 case 'c':
-                        safe_atoi(optarg, &arg_children_max);
+                        r = safe_atoi(optarg, &arg_children_max);
+                        if (r < 0)
+                                log_warning("Invalid --children-max ignored: %s", optarg);
                         break;
                 case 'e':
-                        safe_atoi(optarg, &arg_exec_delay);
+                        r = safe_atoi(optarg, &arg_exec_delay);
+                        if (r < 0)
+                                log_warning("Invalid --exec-delay ignored: %s", optarg);
                         break;
                 case 't':
                         r = safe_atou64(optarg, &arg_event_timeout_usec);
                         if (r < 0)
-                                break;
-                        arg_event_timeout_usec *= USEC_PER_SEC;
-                        arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
+                                log_warning("Invalid --event-timeout ignored: %s", optarg);
+                        else {
+                                arg_event_timeout_usec *= USEC_PER_SEC;
+                                arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
+                        }
                         break;
                 case 'D':
                         arg_debug = true;
@@ -1133,13 +1139,26 @@ int main(int argc, char *argv[]) {
                 goto exit;
         }
 
-        label_init("/dev");
+        r = mac_selinux_init("/dev");
+        if (r < 0) {
+                log_error("could not initialize labelling: %s", strerror(-r));
+                goto exit;
+        }
 
         /* set umask before creating any file/directory */
-        chdir("/");
+        r = chdir("/");
+        if (r < 0) {
+                log_error("could not change dir to /: %m");
+                goto exit;
+        }
+
         umask(022);
 
-        mkdir("/run/udev", 0755);
+        r = mkdir("/run/udev", 0755);
+        if (r < 0 && errno != EEXIST) {
+                log_error("could not create /run/udev: %m");
+                goto exit;
+        }
 
         dev_setup(NULL);
 
@@ -1523,7 +1542,7 @@ exit_daemonize:
         udev_monitor_unref(monitor);
         udev_ctrl_connection_unref(ctrl_conn);
         udev_ctrl_unref(udev_ctrl);
-        label_finish();
+        mac_selinux_finish();
         udev_unref(udev);
         log_close();
         return rc;