From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 05CFB3858D32; Mon, 24 Jul 2023 13:12:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05CFB3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690204358; bh=kmvLO4UM88yQqwRggLRhCSWxbF9L5JMz3NEa8Z/A/Tg=; h=From:To:Subject:Date:From; b=Ps2u63DdExvzEjchsoLcfRzzG/l+2eXjdyMVYPwFKDjL75bbIkTywOevh7KiiwPei 2zd4FFJKDtqPdTHWcXiCgPVzYvU6275P37yc9Hmya5+8pYGcdLtgRBg12Wv9dMPBdL BjQ8DoxivtRyF9ArQQjf6NapQZt6wzFI0p6a31Lk= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] nscd: Use errval, not errno to guide cache update (bug 30662) X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: c437631485a85c3bd034e12f53dd1c8207f05940 X-Git-Newrev: 2d472b48610f6a298d28035b683ab13e9afac4cb Message-Id: <20230724131238.05CFB3858D32@sourceware.org> Date: Mon, 24 Jul 2023 13:12:38 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2d472b48610f6a298d28035b683ab13e9afac4cb commit 2d472b48610f6a298d28035b683ab13e9afac4cb Author: Florian Weimer Date: Mon Jul 24 15:12:26 2023 +0200 nscd: Use errval, not errno to guide cache update (bug 30662) 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 Diff: --- nscd/grpcache.c | 2 +- nscd/pwdcache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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)