]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nscd: Use errval, not errno to guide cache update (bug 30662)
authorFlorian Weimer <fweimer@redhat.com>
Mon, 24 Jul 2023 13:12:26 +0000 (15:12 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 24 Jul 2023 13:12:26 +0000 (15:12 +0200)
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>
nscd/grpcache.c
nscd/pwdcache.c

index cdd1071970db65b63031824b0c0970d5900e3dec..2d01b8451920f433bb3bc7e8df56223fe37f03c7 100644 (file)
@@ -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)
index e1b579de6b1b5e5a2ef8574b39c6becf6d4fb285..e5d51e74ff2e641b157efc13584e45b19e5febcb 100644 (file)
@@ -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)