chiark / gitweb /
bus-proxyd: explicitly address messages to unique and well-known name
[elogind.git] / src / core / device.c
index 2c41c7b6f44964b787ebdf4cfef72cbec6b4b353..11c426108151f9a81b132d9cea76c29ccb7b4d97 100644 (file)
@@ -223,14 +223,13 @@ static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
         const char *word, *state;
         size_t l;
         int r;
+        const char *property;
 
         assert(u);
         assert(dev);
 
-        wants = udev_device_get_property_value(
-                        dev,
-                        u->manager->running_as == SYSTEMD_USER ? "SYSTEMD_USER_WANTS" : "SYSTEMD_WANTS");
-
+        property = u->manager->running_as == SYSTEMD_USER ? "SYSTEMD_USER_WANTS" : "SYSTEMD_WANTS";
+        wants = udev_device_get_property_value(dev, property);
         if (!wants)
                 return 0;
 
@@ -249,6 +248,9 @@ static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
                 if (r < 0)
                         return r;
         }
+        if (!isempty(state))
+                log_warning_unit(u->id, "Property %s on %s has trailing garbage, ignoring.",
+                                 property, strna(udev_device_get_syspath(dev)));
 
         return 0;
 }
@@ -302,7 +304,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
                         goto fail;
                 }
 
-                r = hashmap_ensure_allocated(&m->devices_by_sysfs, string_hash_func, string_compare_func);
+                r = hashmap_ensure_allocated(&m->devices_by_sysfs, &string_hash_ops);
                 if (r < 0)
                         goto fail;
 
@@ -407,6 +409,8 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
                         else
                                 log_warning("SYSTEMD_ALIAS for %s is not an absolute path, ignoring: %s", sysfs, e);
                 }
+                if (!isempty(state))
+                        log_warning("SYSTEMD_ALIAS for %s has trailing garbage, ignoring.", sysfs);
         }
 
         return 0;
@@ -513,7 +517,7 @@ static int device_following_set(Unit *u, Set **_set) {
                 return 0;
         }
 
-        set = set_new(NULL, NULL);
+        set = set_new(NULL);
         if (!set)
                 return -ENOMEM;