From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2138) id E4FE83858CDA; Thu, 30 Mar 2023 11:58:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4FE83858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680177534; bh=yK29xGATHRbpu+umeFxOhxuhn94LbjCtuBUinJCKOrQ=; h=From:To:Subject:Date:From; b=dfmGAvIP7H5XmSengIHfzODr89IUKtocKL0LRm7pcHYxH4giipNH3K1lVD6KBl+Uy P1pmRFwJJVMUGK7HA6tg5UBcSM+3mZsssThohkJAEPi9p1XB48p2SRHNR5TNjxu7Kp J7CuEsegJAiTq1aAXXB+xX9QChy6BVx+Jh7hGQSc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Andreas Schwab To: glibc-cvs@sourceware.org Subject: [glibc] getlogin_r: fix missing fallback if loginuid is unset (bug 30235) X-Act-Checkin: glibc X-Git-Author: Andreas Schwab X-Git-Refname: refs/heads/master X-Git-Oldrev: 24cdd6c71debfd10a9f7cb217fe2a2c4c486ed6f X-Git-Newrev: 0d83b349fa7340475406b2fe933c7467e4584091 Message-Id: <20230330115854.E4FE83858CDA@sourceware.org> Date: Thu, 30 Mar 2023 11:58:54 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0d83b349fa7340475406b2fe933c7467e4584091 commit 0d83b349fa7340475406b2fe933c7467e4584091 Author: Andreas Schwab Date: Wed Mar 15 11:44:24 2023 +0100 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. Diff: --- sysdeps/unix/sysv/linux/getlogin_r.c | 5 +---- 1 file changed, 1 insertion(+), 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;