From patchwork Tue Apr 18 12:11:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Berat X-Patchwork-Id: 1770115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Vf7HHKLD; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q12px1SbBz1ybC for ; Tue, 18 Apr 2023 22:12:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 257153856951 for ; Tue, 18 Apr 2023 12:12:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 257153856951 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681819927; bh=ZDldsk2nxwLvn8lWOJgpooQJTD/vA1+mhXmF/oZPFgI=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Vf7HHKLDbCwodCY+QVvSBoHJr0l2EjEKobXJ0alk5fpVYxAdJZS9ceDdxITNpUnYq BqmaGOmw3FgbBISTu8EeRB22QElEPqud62Km3XPhbPmY9GFu1kNeuaXp6jtR+ATkmE 8SmZ3wIrkn/uBLFtIKaG3UQQYcSd8pCIaQ5+1SDU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A851438582BD for ; Tue, 18 Apr 2023 12:11:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A851438582BD Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-220-Aoq8bYGTMfSBGEDNzFgnlA-1; Tue, 18 Apr 2023 08:11:39 -0400 X-MC-Unique: Aoq8bYGTMfSBGEDNzFgnlA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4AFE88F9E0 for ; Tue, 18 Apr 2023 12:11:38 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.39.193.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 676DB40C83A9; Tue, 18 Apr 2023 12:11:38 +0000 (UTC) To: libc-alpha@sourceware.org Cc: sipoyare@redhat.com Subject: [PATCH 3/8] inet/rcmd.c: fix warn unused result Date: Tue, 18 Apr 2023 14:11:25 +0200 Message-Id: <20230418121130.844302-4-fberat@redhat.com> In-Reply-To: <20230418121130.844302-1-fberat@redhat.com> References: <20230418121130.844302-1-fberat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?Fr=C3=A9d=C3=A9ric_B=C3=A9rat_via_Libc-alpha?= From: Frederic Berat Reply-To: =?utf-8?b?RnLDqWTDqXJpYyBCw6lyYXQ=?= Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in glibc. Reviewed-by: Siddhesh Poyarekar --- inet/rcmd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inet/rcmd.c b/inet/rcmd.c index ad8a894907..c1cd9daeb5 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -561,7 +561,9 @@ ruserok2_sa (struct sockaddr *ra, size_t ralen, int superuser, reading an NFS mounted file system, can't read files that are protected read/write owner only. */ uid = __geteuid (); - seteuid (pwd->pw_uid); + if (seteuid (pwd->pw_uid) < 0) + return -1; + hostf = iruserfopen (pbuf, pwd->pw_uid); if (hostf != NULL) @@ -570,7 +572,8 @@ ruserok2_sa (struct sockaddr *ra, size_t ralen, int superuser, fclose (hostf); } - seteuid (uid); + if (seteuid (uid) < 0) + return -1; return isbad; } return -1;