return 0;
}
-static int attach_device(Manager *m, const char *seat, const char *sysfs) {
+static int attach_device(Manager *m, const char *seat, const char *sysfs, sd_bus_error *error) {
_cleanup_(sd_device_unrefp) sd_device *d = NULL;
_cleanup_free_ char *rule = NULL, *file = NULL;
const char *id_for_seat;
r = sd_device_new_from_syspath(&d, sysfs);
if (r < 0)
- return r;
+ return sd_bus_error_set_errnof(error, r, "Failed to open device '%s': %m", sysfs);
if (sd_device_has_current_tag(d, "seat") <= 0)
- return -ENODEV;
+ return sd_bus_error_set_errnof(error, ENODEV, "Device '%s' lacks 'seat' udev tag.", sysfs);
if (sd_device_get_property_value(d, "ID_FOR_SEAT", &id_for_seat) < 0)
- return -ENODEV;
+ return sd_bus_error_set_errnof(error, ENODEV, "Device '%s' lacks 'ID_FOR_SEAT' udev property.", sysfs);
if (asprintf(&file, "/etc/udev/rules.d/72-seat-%s.rules", id_for_seat) < 0)
return -ENOMEM;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
- r = attach_device(m, seat, sysfs);
+ r = attach_device(m, seat, sysfs, error);
if (r < 0)
return r;