]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-login: fix sd_seat_get_active() to return ENODATA v226
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 8 Sep 2015 12:03:22 +0000 (14:03 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Tue, 8 Sep 2015 12:03:22 +0000 (14:03 +0200)
This seems to be an oversight from:
    707b66c66381c899d7ef640e158ffdd5bcff4deb

We have to return ENODATA instead of ENOENT if a requested entry is
non-present. Also fix the call-site in udev to check for these errors.

src/libsystemd/sd-login/sd-login.c
src/udev/udev-builtin-uaccess.c

index 55da26e9d90bf6d36b111ae1999a6bc28393b0b9..265c7c7db2aa378c5b911e6b8cc4aaec98f66438 100644 (file)
@@ -645,10 +645,10 @@ _public_ int sd_seat_get_active(const char *seat, char **session, uid_t *uid) {
                 return r;
 
         if (session && !s)
-                return -ENOENT;
+                return -ENODATA;
 
         if (uid && !t)
-                return -ENOENT;
+                return -ENODATA;
 
         if (uid && t) {
                 r = parse_uid(t, uid);
index 43bab8af6388a3d34cb50c7a47c8147541f13403..7bf4e7f24d806302eb64ecbee85d9c85b382e367 100644 (file)
@@ -45,7 +45,7 @@ static int builtin_uaccess(struct udev_device *dev, int argc, char *argv[], bool
                 seat = "seat0";
 
         r = sd_seat_get_active(seat, NULL, &uid);
-        if (r == -ENOENT) {
+        if (r == -ENXIO || r == -ENODATA) {
                 /* No active session on this seat */
                 r = 0;
                 goto finish;