about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2023-03-15 11:44:24 +0100
committerAndreas Schwab <schwab@suse.de>2023-03-30 13:58:27 +0200
commit0d83b349fa7340475406b2fe933c7467e4584091 (patch)
treea6f75b862ef48445e19bd2764f8a69529a14c359 /sysdeps/unix
parent24cdd6c71debfd10a9f7cb217fe2a2c4c486ed6f (diff)
downloadglibc-0d83b349fa7340475406b2fe933c7467e4584091.tar.gz
glibc-0d83b349fa7340475406b2fe933c7467e4584091.tar.xz
glibc-0d83b349fa7340475406b2fe933c7467e4584091.zip
getlogin_r: fix missing fallback if loginuid is unset (bug 30235)
When /proc/self/loginuid is not set, we should still fall back to using
the traditional utmp lookup, instead of failing right away.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/getlogin_r.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c
index 879df85a16..4ae9a53503 100644
--- a/sysdeps/unix/sysv/linux/getlogin_r.c
+++ b/sysdeps/unix/sysv/linux/getlogin_r.c
@@ -59,10 +59,7 @@ __getlogin_r_loginuid (char *name, size_t namesize)
      value of, (uid_t) -1, so check if that value is set and return early to
      avoid making unneeded nss lookups. */
   if (uid == (uid_t) -1)
-    {
-      __set_errno (ENXIO);
-      return ENXIO;
-    }
+    return -1;
 
   struct passwd pwd;
   struct passwd *tpwd;