void-packages/srcpkgs/glibc/patches/glibc-upstream-25.patch
2017-10-10 15:39:48 +00:00

47 lines
1.6 KiB
Diff

From 7ab87bccb657b02cac5a3360b11c67aff901de2e Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 1 Sep 2017 08:57:52 +0200
Subject: [PATCH 25] getaddrinfo: In gaih_inet, use h_errno for certain
status values only
h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be
accurate at this point.
(cherry picked from commit a2881ef01450295782b065f2f850f340d5c12c14)
---
ChangeLog | 5 +++++
sysdeps/posix/getaddrinfo.c | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 2f959d4c36..c58cd5ccd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if
+ status indicates it is set.
+
+2017-09-01 Florian Weimer <fweimer@redhat.com>
+
* sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS
function lookup failures more reliable.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index eaf8bafcf4..9d9e7e2bf2 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -949,7 +949,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
__resolv_context_enable_inet6 (res_ctx, res_enable_inet6);
__resolv_context_put (res_ctx);
- if (h_errno == NETDB_INTERNAL)
+ /* If we have a failure which sets errno, report it using
+ EAI_SYSTEM. */
+ if ((status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL)
+ && h_errno == NETDB_INTERNAL)
{
result = -EAI_SYSTEM;
goto free_and_return;