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: 73056 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 CF84C385417F for ; Fri, 21 Jul 2023 15:42:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF84C385417F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689954159; 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=mb2lJSGvsC4Fec+axd5NloYNWJP19Vz2D4wwbJDxSY4TzEtF9aFcBp+dxgZ93/2eb moLe7fhd40MCv941OsyRNx7ES6Ge1tYVoLiyc5iqPoBFRzj+3+mbX93JBdvS6n4maK q514C9OaFApGC4bmdwrBhZaNg4lbZNW6SvduA2h0= 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+patchwork=sourceware.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)