]> sourceware.org Git - glibc.git/commitdiff
getlogin_r: fix missing fallback if loginuid is unset (bug 30235)
authorAndreas Schwab <schwab@suse.de>
Wed, 15 Mar 2023 10:44:24 +0000 (11:44 +0100)
committerAndreas Schwab <schwab@suse.de>
Thu, 30 Mar 2023 11:58:27 +0000 (13:58 +0200)
When /proc/self/loginuid is not set, we should still fall back to using
the traditional utmp lookup, instead of failing right away.

sysdeps/unix/sysv/linux/getlogin_r.c

index 879df85a16b9a60169aa914d1d239a3a78dc65af..4ae9a53503ae83c521e755538c5955f10e68254d 100644 (file)
@@ -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;
This page took 0.0448769999999999 seconds and 5 git commands to generate.