glibc/0025-getnameinfo-Do-not-preserve-errno.patch
Dominique Leuenberger 043c4769d6 Accepting request 394999 from Base:System
- Import patches from 2.23 branch (forwarded request 394998 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/394999
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=202
2016-05-19 10:02:35 +00:00

49 lines
1.2 KiB
Diff

2016-04-28 Florian Weimer <fweimer@redhat.com>
* inet/getnameinfo.c (getnameinfo): Do not preserve errno.
Index: glibc-2.23/inet/getnameinfo.c
===================================================================
--- glibc-2.23.orig/inet/getnameinfo.c
+++ glibc-2.23/inet/getnameinfo.c
@@ -175,7 +175,6 @@ getnameinfo (const struct sockaddr *sa,
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,
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,
};
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,
host[hostlen-1] = 0;
if (serv && (servlen > 0))
serv[servlen-1] = 0;
- errno = serrno;
return 0;
}
libc_hidden_def (getnameinfo)