public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] nscd: Use errval, not errno to guide cache update (bug 30662)
Date: Mon, 24 Jul 2023 13:12:38 +0000 (GMT)	[thread overview]
Message-ID: <20230724131238.05CFB3858D32@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2d472b48610f6a298d28035b683ab13e9afac4cb

commit 2d472b48610f6a298d28035b683ab13e9afac4cb
Author: Florian Weimer <fweimer@redhat.com>
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 <siddhesh@sourceware.org>

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)

                 reply	other threads:[~2023-07-24 13:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230724131238.05CFB3858D32@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).