]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevd: refuse devices which do not have ACTION property 11196/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Jan 2019 00:31:56 +0000 (09:31 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Jan 2019 00:32:20 +0000 (09:32 +0900)
src/udev/udevd.c

index d7d2ca10f091ea569f64a8c373cd1323751214fc..51f9bfdd3f6b8a3e14da5ee1e8b406a6788ce8aa 100644 (file)
@@ -587,8 +587,8 @@ static void event_run(Manager *manager, struct event *event) {
 
 static int event_queue_insert(Manager *manager, sd_device *dev) {
         _cleanup_(sd_device_unrefp) sd_device *clone = NULL;
+        const char *val, *action;
         struct event *event;
-        const char *val;
         uint64_t seqnum;
         int r;
 
@@ -613,6 +613,11 @@ static int event_queue_insert(Manager *manager, sd_device *dev) {
         if (seqnum == 0)
                 return -EINVAL;
 
+        /* Refuse devices do not have ACTION property. */
+        r = sd_device_get_property_value(dev, "ACTION", &action);
+        if (r < 0)
+                return r;
+
         /* Save original device to restore the state on failures. */
         r = device_shallow_clone(dev, &clone);
         if (r < 0)
@@ -642,12 +647,7 @@ static int event_queue_insert(Manager *manager, sd_device *dev) {
 
         LIST_APPEND(event, manager->events, event);
 
-        if (DEBUG_LOGGING) {
-                if (sd_device_get_property_value(dev, "ACTION", &val) < 0)
-                        val = NULL;
-
-                log_device_debug(dev, "Device (SEQNUM=%"PRIu64", ACTION=%s) is queued", seqnum, strnull(val));
-        }
+        log_device_debug(dev, "Device (SEQNUM=%"PRIu64", ACTION=%s) is queued", seqnum, action);
 
         return 0;
 }