mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
getnameinfo: Do not preserve errno
POSIX does not require it, the companion getaddrinfo implementation does not do it, and this behavior is not documented in the manual page, either.
This commit is contained in:
parent
ed3c7876cc
commit
2b54cbce2c
@ -1,3 +1,7 @@
|
||||
2016-04-28 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* inet/getnameinfo.c (getnameinfo): Do not preserve errno.
|
||||
|
||||
2016-04-28 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* resolv/inet_addr.c: Reindent preprocessor conditionals.
|
||||
|
@ -175,7 +175,6 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
|
||||
socklen_t hostlen, char *serv, socklen_t servlen,
|
||||
int flags)
|
||||
{
|
||||
int serrno = errno;
|
||||
int herrno;
|
||||
struct hostent th;
|
||||
int ok = 0;
|
||||
@ -326,10 +325,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
|
||||
if (!ok)
|
||||
{
|
||||
if (flags & NI_NAMEREQD)
|
||||
{
|
||||
__set_errno (serrno);
|
||||
return EAI_NONAME;
|
||||
}
|
||||
return EAI_NONAME;
|
||||
else
|
||||
{
|
||||
const char *c;
|
||||
@ -406,10 +402,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
|
||||
};
|
||||
|
||||
if (flags & NI_NAMEREQD)
|
||||
{
|
||||
__set_errno (serrno);
|
||||
return EAI_NONAME;
|
||||
}
|
||||
return EAI_NONAME;
|
||||
|
||||
strncpy (host, "localhost", hostlen);
|
||||
break;
|
||||
@ -463,7 +456,6 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
|
||||
host[hostlen-1] = 0;
|
||||
if (serv && (servlen > 0))
|
||||
serv[servlen-1] = 0;
|
||||
errno = serrno;
|
||||
return 0;
|
||||
}
|
||||
libc_hidden_def (getnameinfo)
|
||||
|
Loading…
Reference in New Issue
Block a user