aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-09-01 08:57:28 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-09-01 08:57:28 +0200
commitad816a5e00ce891a2cea8187638fa0e00f83aaf6 (patch)
tree4985fd02781cfe3ff533f619afd87bed6d6e9f70 /sysdeps/posix
parent53250a21b81474ef4e78090a4a9a63d8471e1091 (diff)
downloadglibc-ad816a5e00ce891a2cea8187638fa0e00f83aaf6.zip
glibc-ad816a5e00ce891a2cea8187638fa0e00f83aaf6.tar.gz
glibc-ad816a5e00ce891a2cea8187638fa0e00f83aaf6.tar.bz2
getaddrinfo: Properly set errno for NSS function lookup failure
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 4edd5e2..95b5148 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -922,13 +922,17 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
else
{
+ /* Could not locate any of the lookup functions.
+ The NSS lookup code does not consistently set
+ errno, so we need to supply our own error
+ code here. The root cause could either be a
+ resource allocation failure, or a missing
+ service function in the DSO (so it should not
+ be listed in /etc/nsswitch.conf). Assume the
+ former, and return EBUSY. */
status = NSS_STATUS_UNAVAIL;
- /* Could not load any of the lookup functions. Indicate
- an internal error if the failure was due to a system
- error other than the file not being found. We use the
- errno from the last failed callback. */
- if (errno != 0 && errno != ENOENT)
- __set_h_errno (NETDB_INTERNAL);
+ __set_h_errno (NETDB_INTERNAL);
+ __set_errno (EBUSY);
}
}