Skip to content

Commit 4211d5b

Browse files
author
David Herrmann
committed
sd-login: fix sd_seat_get_active() to return ENODATA
This seems to be an oversight from: 707b66c 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.
1 parent 23d08d1 commit 4211d5b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/libsystemd/sd-login/sd-login.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,10 @@ _public_ int sd_seat_get_active(const char *seat, char **session, uid_t *uid) {
645645
return r;
646646

647647
if (session && !s)
648-
return -ENOENT;
648+
return -ENODATA;
649649

650650
if (uid && !t)
651-
return -ENOENT;
651+
return -ENODATA;
652652

653653
if (uid && t) {
654654
r = parse_uid(t, uid);

src/udev/udev-builtin-uaccess.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int builtin_uaccess(struct udev_device *dev, int argc, char *argv[], bool
4545
seat = "seat0";
4646

4747
r = sd_seat_get_active(seat, NULL, &uid);
48-
if (r == -ENOENT) {
48+
if (r == -ENXIO || r == -ENODATA) {
4949
/* No active session on this seat */
5050
r = 0;
5151
goto finish;

0 commit comments

Comments
 (0)