Blame SOURCES/glibc-rh1563046.patch

147e83
commit cc8a1620eb97ccddd337d157263c13c57b39ab71
147e83
Author: Jesse Hathaway <jesse@mbuki-mvuki.org>
147e83
Date:   Tue Mar 27 21:17:59 2018 +0000
147e83
147e83
    getlogin_r: return early when linux sentinel value is set
147e83
    
147e83
    When there is no login uid Linux sets /proc/self/loginid to the sentinel
147e83
    value of, (uid_t) -1. If this is set we can return early and avoid
147e83
    needlessly looking up the sentinel value in any configured nss
147e83
    databases.
147e83
    
147e83
    Checked on aarch64-linux-gnu.
147e83
    
147e83
            * sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Return
147e83
            early when linux sentinel value is set.
147e83
    
147e83
    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
147e83
147e83
Index: b/sysdeps/unix/sysv/linux/getlogin_r.c
147e83
===================================================================
147e83
--- a/sysdeps/unix/sysv/linux/getlogin_r.c
147e83
+++ b/sysdeps/unix/sysv/linux/getlogin_r.c
147e83
@@ -54,6 +54,15 @@ __getlogin_r_loginuid (char *name, size_
147e83
 	  endp == uidbuf || *endp != '\0'))
147e83
     return -1;
147e83
 
147e83
+  /* If there is no login uid, linux sets /proc/self/loginid to the sentinel
147e83
+     value of, (uid_t) -1, so check if that value is set and return early to
147e83
+     avoid making unneeded nss lookups. */
147e83
+  if (uid == (uid_t) -1)
147e83
+    {
147e83
+      __set_errno (ENXIO);
147e83
+      return ENXIO;
147e83
+    }
147e83
+
147e83
   size_t buflen = 1024;
147e83
   char *buf = alloca (buflen);
147e83
   bool use_malloc = false;