X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Fdevice.c;h=11c426108151f9a81b132d9cea76c29ccb7b4d97;hb=adeba5008eac3105ae59256dedd087ebe006a9e6;hp=2c41c7b6f44964b787ebdf4cfef72cbec6b4b353;hpb=a2a5291b3f5ab6ed4c92f51d0fd10a03047380d8;p=elogind.git diff --git a/src/core/device.c b/src/core/device.c index 2c41c7b6f..11c426108 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -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;