summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-01-12 01:31:56 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-01-12 01:32:20 +0100
commite0b7a5d1510e2c2201b99ac6545eb34db1afe04f (patch)
treee437ed2b34a8473fc6f9dfcc33288b0a200a57b1 /src
parentudevd: drop unnecessary brackets (diff)
downloadsystemd-e0b7a5d1510e2c2201b99ac6545eb34db1afe04f.tar.xz
systemd-e0b7a5d1510e2c2201b99ac6545eb34db1afe04f.zip
udevd: refuse devices which do not have ACTION property
Diffstat (limited to 'src')
-rw-r--r--src/udev/udevd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index d7d2ca10f0..51f9bfdd3f 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -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;
}