]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: unify reporting of invalid cmdline keys 648/head
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 21 Jul 2015 16:35:18 +0000 (18:35 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Tue, 21 Jul 2015 18:07:34 +0000 (20:07 +0200)
This way it does not need distinct string literals and it also preserves
the "rd." prefix.

src/udev/udevd.c

index f14efbe20350ab0bdcf44c9454a6be5db6891d89..945845d72c04d73bb5bd649c5d8130609db54bd7 100644 (file)
@@ -1358,6 +1358,7 @@ static int listen_fds(int *rctrl, int *rnetlink) {
  *   udev.event-timeout=<number of seconds>    seconds to wait before terminating an event
  */
 static int parse_proc_cmdline_item(const char *key, const char *value) {
+        const char *full_key = key;
         int r;
 
         assert(key);
@@ -1378,27 +1379,27 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
 
                 prio = util_log_priority(value);
                 if (prio < 0)
-                        log_warning("invalid udev.log-priority ignored: %s", value);
-                else
-                        log_set_max_level(prio);
+                        goto invalid;
+                log_set_max_level(prio);
         } else if (streq(key, "children-max")) {
                 r = safe_atou(value, &arg_children_max);
                 if (r < 0)
-                        log_warning("invalid udev.children-max ignored: %s", value);
+                        goto invalid;
         } else if (streq(key, "exec-delay")) {
                 r = safe_atoi(value, &arg_exec_delay);
                 if (r < 0)
-                        log_warning("invalid udev.exec-delay ignored: %s", value);
+                        goto invalid;
         } else if (streq(key, "event-timeout")) {
                 r = safe_atou64(value, &arg_event_timeout_usec);
                 if (r < 0)
-                        log_warning("invalid udev.event-timeout ignored: %s", value);
-                else {
-                        arg_event_timeout_usec *= USEC_PER_SEC;
-                        arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
-                }
+                        goto invalid;
+                arg_event_timeout_usec *= USEC_PER_SEC;
+                arg_event_timeout_warn_usec = (arg_event_timeout_usec / 3) ? : 1;
         }
 
+        return 0;
+invalid:
+        log_warning("invalid %s ignored: %s", full_key, value);
         return 0;
 }