From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id B93143858CDA for ; Thu, 30 Mar 2023 11:33:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B93143858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id C0F4F72C97E for ; Thu, 30 Mar 2023 14:33:54 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id AD0587CF952; Thu, 30 Mar 2023 14:33:54 +0300 (IDT) Date: Thu, 30 Mar 2023 14:33:54 +0300 From: "Dmitry V. Levin" To: libc-alpha@sourceware.org Subject: Re: [PATCH] getlogin_r: fix missing fallback if loginuid is unset (bug 30235) Message-ID: <20230330113354.GA32706@altlinux.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Mar 30, 2023 at 01:09:24PM +0200, Andreas Schwab via Libc-alpha wrote: > 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 | 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; LGTM, thanks. -- ldv