summaryrefslogtreecommitdiff
path: root/backport-Use-errval-not-errno-to-guide-cache-update.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-03 06:28:41 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-03 06:28:41 +0000
commitd20db0561a6a36f914fde030512503b114ef9a0c (patch)
treed4e5e3494d95c269a1cee6195f11bf3201bcadbf /backport-Use-errval-not-errno-to-guide-cache-update.patch
parent016343d99b1b269d7246ef1e143d4b54914433d4 (diff)
Diffstat (limited to 'backport-Use-errval-not-errno-to-guide-cache-update.patch')
-rw-r--r--backport-Use-errval-not-errno-to-guide-cache-update.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/backport-Use-errval-not-errno-to-guide-cache-update.patch b/backport-Use-errval-not-errno-to-guide-cache-update.patch
new file mode 100644
index 0000000..c941b0a
--- /dev/null
+++ b/backport-Use-errval-not-errno-to-guide-cache-update.patch
@@ -0,0 +1,49 @@
+From 2d472b48610f6a298d28035b683ab13e9afac4cb Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Mon, 24 Jul 2023 15:12:26 +0200
+Subject: [PATCH] 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>
+
+Conflict:NA
+Reference:https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2d472b48610f6a298d28035b683ab13e9afac4cb
+
+---
+ 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 457ca4d8..d18bcabe 100644
+--- a/nscd/grpcache.c
++++ b/nscd/grpcache.c
+@@ -117,7 +117,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 dfafb526..409c5acd 100644
+--- a/nscd/pwdcache.c
++++ b/nscd/pwdcache.c
+@@ -123,7 +123,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)
+--
+2.33.0
+