From patchwork Fri Jul 21 15:42:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1810990 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=2620:52:3:1:0:246e:9693:128c; helo=server2.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=O2FeyE7r; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4R6v2M3rqzz20Fh for ; Sat, 22 Jul 2023 01:42:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CD64385C017 for ; Fri, 21 Jul 2023 15:42:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CD64385C017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689954152; bh=FTerCBRoJ0DswK4WP+gFi9GzWmFxTBIpwjx0/98veJo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=O2FeyE7rQUeJ3q8vXhL9metK9XczPszHVB5hP75B+KfdCvqD6YsGyTInerhQurXJU XNEMxF/Pp/PZAOx1/wjm1bPZbD0WzbPf/wgTUA6w7lfm3IM81Jg29H5UKBFfyuJAQB inQoNJssppN550i60bAK15eMMs1a1aaCOmzT5osU= 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 8DBB63858409 for ; Fri, 21 Jul 2023 15:42:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8DBB63858409 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-kaXbT7SFNQShGUp3wnl9Jg-1; Fri, 21 Jul 2023 11:42:13 -0400 X-MC-Unique: kaXbT7SFNQShGUp3wnl9Jg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6E9933815EEB for ; Fri, 21 Jul 2023 15:42:13 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14F471401C2E for ; Fri, 21 Jul 2023 15:42:12 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] nscd: Use errval, not errno to guide cache update (bug 30662) Date: Fri, 21 Jul 2023 17:42:08 +0200 Message-ID: <87zg3ps23z.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.9 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_H4, RCVD_IN_MSPIKE_WL, 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: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The errno variable is potentially clobbered by the preceding send call. It is not related to the to-be-cached information. The parallel code in hstcache.c and servicescache.c already uses errval. Reviewed-by: Siddhesh Poyarekar --- nscd/grpcache.c | 2 +- nscd/pwdcache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) base-commit: 2c6b4b272e6b4d07303af25709051c3e96288f2d diff --git a/nscd/grpcache.c b/nscd/grpcache.c index cdd1071970..2d01b84519 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -116,7 +116,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, /* If we have a transient error or cannot permanently store the result, so be it. */ - if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0)) + if (errval == EAGAIN || __glibc_unlikely (db->negtimeout == 0)) { /* Mark the old entry as obsolete. */ if (dh != NULL) diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c index e1b579de6b..e5d51e74ff 100644 --- a/nscd/pwdcache.c +++ b/nscd/pwdcache.c @@ -122,7 +122,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, /* If we have a transient error or cannot permanently store the result, so be it. */ - if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0)) + if (errval == EAGAIN || __glibc_unlikely (db->negtimeout == 0)) { /* Mark the old entry as obsolete. */ if (dh != NULL)