chiark / gitweb /
udevd: parse_argv - warn if argumens are invalid
authorTom Gundersen <teg@jklm.no>
Thu, 18 Sep 2014 17:02:03 +0000 (19:02 +0200)
committerTom Gundersen <teg@jklm.no>
Thu, 18 Sep 2014 17:02:42 +0000 (19:02 +0200)
Found by Coverity. Fixes CID #1238780.

src/udev/udevd.c

index cd517931d342f8599bf42d9e098915bbc61857f7..95c646802918ee8da6083069a6881da2f8acfc5c 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("Invalig --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;