bool add, uid_t new_uid) {
acl_t acl;
- int r;
+ int r = 0;
bool changed = false;
assert(path);
assert(udev);
- if (!seat)
+ if (isempty(seat))
seat = "seat0";
e = udev_enumerate_new(udev);
if (!e)
return -ENOMEM;
+ /* We can only match by one tag in libudev. We choose
+ * "uaccess" for that. If we could match for two tags here we
+ * could add the seat name as second match tag, but this would
+ * be hardly optimizable in libudev, and hence checking the
+ * second tag manually in our loop is a good solution. */
+
r = udev_enumerate_add_match_tag(e, "uaccess");
if (r < 0)
goto finish;
- if (!streq(seat, "seat0")) {
- r = udev_enumerate_add_match_tag(e, seat);
- if (r < 0)
- goto finish;
- }
-
r = udev_enumerate_scan_devices(e);
if (r < 0)
goto finish;
goto finish;
}
- sn = udev_device_get_property_value(d, "SEAT");
- if (!sn)
+ sn = udev_device_get_property_value(d, "ID_SEAT");
+ if (isempty(sn))
sn = "seat0";
if (!streq(seat, sn)) {
node = udev_device_get_devnode(d);
if (!node) {
+ /* In case people mistag devices with nodes, we need to ignore this */
udev_device_unref(d);
- r = -ENOMEM;
- goto finish;
+ continue;
}
+ log_debug("Fixing up %s for seat %s...", node, sn);
+
r = devnode_acl(node, flush, del, old_uid, add, new_uid);
udev_device_unref(d);