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>
This commit is contained in:
Florian Weimer 2023-07-24 15:12:26 +02:00
parent c437631485
commit 2d472b4861
2 changed files with 2 additions and 2 deletions

View 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)

View 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)