From patchwork Thu Mar 30 11:09:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 67114 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6F437385CDE3 for ; Thu, 30 Mar 2023 11:09:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F437385CDE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680174589; bh=TkDq18o8l0sri4dD6BAJhPtP8/SCMd45bDwcxhEGoDk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=xj0ZPY2+8dBjMfuPw9yjWlaP823CREdKQf3ucW07KmPGcONkeou/HLdCkvdI3uEFF qaFz+1otOR/I/kI+hI4mNlfvGnFqJmbQMFXgYzf7OqZbS9xH6A9wX85wLl0lG5l+gy FbFmR5MkinwT3XZ1gC/InWrOFAtVOBiST6ha7J+E= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id E5E213858C78 for ; Thu, 30 Mar 2023 11:09:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E5E213858C78 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 2A8C51FEC8 for ; Thu, 30 Mar 2023 11:09:24 +0000 (UTC) Received: from hawking.suse.de (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 20DBA2C423 for ; Thu, 30 Mar 2023 11:09:24 +0000 (UTC) Received: by hawking.suse.de (Postfix, from userid 17005) id 138264A0378; Thu, 30 Mar 2023 13:09:24 +0200 (CEST) To: libc-alpha@sourceware.org Subject: [PATCH] getlogin_r: fix missing fallback if loginuid is unset (bug 30235) X-Yow: I'll take ROAST BEEF if you're out of LAMB!! Date: Thu, 30 Mar 2023 13:09:24 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andreas Schwab via Libc-alpha From: Andreas Schwab Reply-To: Andreas Schwab Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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;