mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 13:00:06 +00:00
getaddrinfo: Properly set errno for NSS function lookup failure
This commit is contained in:
parent
53250a21b8
commit
ad816a5e00
@ -1,3 +1,8 @@
|
||||
2017-09-01 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS
|
||||
function lookup failures more reliable.
|
||||
|
||||
2017-09-01 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* sysdeps/posix/getaddrinfo.c (gethosts): Use h_errno directly.
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user