summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-11-13 20:35:06 +0100
committerKay Sievers <kay@vrfy.org>2014-11-13 20:35:06 +0100
commitadeba5008eac3105ae59256dedd087ebe006a9e6 (patch)
tree5b8dd3f0e7c6e47b560e89fd48f3039e1201a78e /src/udev/udev-rules.c
parentudev: move global property handling from libudev to udevd (diff)
downloadsystemd-adeba5008eac3105ae59256dedd087ebe006a9e6.tar.xz
systemd-adeba5008eac3105ae59256dedd087ebe006a9e6.zip
udev: support ENV{}=="" global property matches
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r--src/udev/udev-rules.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index c02295fbe2..093d68cf0c 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1876,6 +1876,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
struct udev_event *event,
usec_t timeout_usec,
usec_t timeout_warn_usec,
+ struct udev_list *properties_list,
const sigset_t *sigmask) {
struct token *cur;
struct token *rule;
@@ -1941,7 +1942,18 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
const char *value;
value = udev_device_get_property_value(event->dev, key_name);
- if (value == NULL)
+
+ /* check global properties */
+ if (!value && properties_list) {
+ struct udev_list_entry *list_entry;
+
+ list_entry = udev_list_get_entry(properties_list);
+ list_entry = udev_list_entry_get_by_name(list_entry, key_name);
+ if (list_entry != NULL)
+ value = udev_list_entry_get_value(list_entry);
+ }
+
+ if (!value)
value = "";
if (match_key(rules, cur, value))
goto nomatch;