chiark / gitweb /
sd-device: enumerator - fix matching on properties and sysattrs
authorTom Gundersen <teg@jklm.no>
Thu, 28 May 2015 15:18:33 +0000 (17:18 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:01:12 +0000 (10:01 +0100)
This was a regression that broke

  $ udevadm trigger -nv --property-match=DEVNAME=/dev/sda1 --attr-match=size=409600

Reported by David Reisner.

src/libsystemd/sd-device/device-enumerator.c

index 1d79aff8b454008dadca66ec0cbb5ac9223d1e74..71f605c5fc339da219c417a477c0ca1cf0646eda 100644 (file)
@@ -374,11 +374,11 @@ static bool match_sysattr(sd_device_enumerator *enumerator, sd_device *device) {
         assert(enumerator);
         assert(device);
 
-        HASHMAP_FOREACH_KEY(sysattr, value, enumerator->nomatch_sysattr, i)
+        HASHMAP_FOREACH_KEY(value, sysattr, enumerator->nomatch_sysattr, i)
                 if (match_sysattr_value(device, sysattr, value))
                         return false;
 
-        HASHMAP_FOREACH_KEY(sysattr, value, enumerator->match_sysattr, i)
+        HASHMAP_FOREACH_KEY(value, sysattr, enumerator->match_sysattr, i)
                 if (!match_sysattr_value(device, sysattr, value))
                         return false;
 
@@ -396,7 +396,7 @@ static bool match_property(sd_device_enumerator *enumerator, sd_device *device)
         if (hashmap_isempty(enumerator->match_property))
                 return true;
 
-        HASHMAP_FOREACH_KEY(property, value, enumerator->match_property, i) {
+        HASHMAP_FOREACH_KEY(value, property, enumerator->match_property, i) {
                 const char *property_dev, *value_dev;
 
                 FOREACH_DEVICE_PROPERTY(device, property_dev, value_dev) {