summaryrefslogtreecommitdiff
path: root/udev/lib/libudev-enumerate.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-06-07 01:51:38 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-06-07 01:51:38 +0200
commit701a57da317ebf0a641bef2be9a4f77d291e01f5 (patch)
tree0f3208c6d614d873e3f5e3ee8a2495d5e33a8eb3 /udev/lib/libudev-enumerate.c
parent93ee84ce079c472ef22403c86a3081324d6eef40 (diff)
libudev: enumerate - allow multiple keys with the same name
Diffstat (limited to 'udev/lib/libudev-enumerate.c')
-rw-r--r--udev/lib/libudev-enumerate.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c
index c236a1c1b6..63f84062b2 100644
--- a/udev/lib/libudev-enumerate.c
+++ b/udev/lib/libudev-enumerate.c
@@ -131,7 +131,7 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons
if (sysattr == NULL)
return 0;
if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate),
- &udev_enumerate->sysattr_match_list, sysattr, value, 1, 0) == NULL)
+ &udev_enumerate->sysattr_match_list, sysattr, value, 0, 0) == NULL)
return -ENOMEM;
return 0;
}
@@ -143,7 +143,7 @@ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, co
if (sysattr == NULL)
return 0;
if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate),
- &udev_enumerate->sysattr_nomatch_list, sysattr, value, 1, 0) == NULL)
+ &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0, 0) == NULL)
return -ENOMEM;
return 0;
}
@@ -180,7 +180,7 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con
if (property == NULL)
return 0;
if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate),
- &udev_enumerate->properties_match_list, property, value, 1, 0) == NULL)
+ &udev_enumerate->properties_match_list, property, value, 0, 0) == NULL)
return -ENOMEM;
return 0;
}
@@ -228,26 +228,26 @@ static int match_property(struct udev_enumerate *udev_enumerate, const char *sys
/* loop over matches */
udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) {
+ const char *match_key = udev_list_entry_get_name(list_entry);
+ const char *match_value = udev_list_entry_get_value(list_entry);
struct udev_list_entry *property_entry;
/* loop over device properties */
udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) {
- if (fnmatch(udev_list_entry_get_name(list_entry), udev_list_entry_get_name(property_entry), 0) == 0) {
- const char *match_value;
- const char *dev_value;
-
- match_value = udev_list_entry_get_value(list_entry);
- dev_value = udev_list_entry_get_value(property_entry);
- if (match_value == NULL && dev_value == NULL) {
- match = 1;
- goto out;
- }
- if (match_value == NULL || dev_value == NULL)
- continue;
- if (fnmatch(match_value, dev_value, 0) == 0) {
- match = 1;
- goto out;
- }
+ const char *dev_key = udev_list_entry_get_name(property_entry);
+ const char *dev_value = udev_list_entry_get_value(property_entry);
+
+ if (fnmatch(match_key, dev_key, 0) != 0)
+ continue;
+ if (match_value == NULL && dev_value == NULL) {
+ match = 1;
+ goto out;
+ }
+ if (match_value == NULL || dev_value == NULL)
+ continue;
+ if (fnmatch(match_value, dev_value, 0) == 0) {
+ match = 1;
+ goto out;
}
}
}