chiark / gitweb /
update TODO
[elogind.git] / src / logind-acl.c
index 5ea68185bd2fde351aac6a93c9f193df825f81ea..7f9b0ca15ed91d65ca8777e7f7cb901340b548cc 100644 (file)
@@ -105,7 +105,7 @@ int devnode_acl(const char *path,
                 bool add, uid_t new_uid) {
 
         acl_t acl;
-        int r;
+        int r = 0;
         bool changed = false;
 
         assert(path);
@@ -222,18 +222,20 @@ int devnode_acl_all(struct udev *udev,
 
         assert(udev);
 
-        if (!seat)
+        if (isempty(seat))
                 seat = "seat0";
 
         e = udev_enumerate_new(udev);
         if (!e)
                 return -ENOMEM;
 
-        r = udev_enumerate_add_match_tag(e, "uaccess");
-        if (r < 0)
-                goto finish;
+        /* 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, seat);
+        r = udev_enumerate_add_match_tag(e, "uaccess");
         if (r < 0)
                 goto finish;
 
@@ -252,8 +254,8 @@ int devnode_acl_all(struct udev *udev,
                         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)) {
@@ -268,6 +270,8 @@ int devnode_acl_all(struct udev *udev,
                         goto finish;
                 }
 
+                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);