Patchwork getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]

login
register
mail settings
Submitter Florian Weimer
Date Aug. 8, 2017, 5:01 p.m.
Message ID <20170808170144.407DB4029923B@oldenburg.str.redhat.com>
Download mbox | patch
Permalink /patch/21991/
State New
Headers show

Comments

Florian Weimer - Aug. 8, 2017, 5:01 p.m.
2017-08-08  Florian Weimer  <fweimer@redhat.com>

	[BZ #21922]
	* sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error
	coming from gethostbyname2_r.

Patch

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 9d9e7e2..0cf87c2 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -619,6 +619,14 @@  gaih_inet (const char *name, const struct gaih_service *service,
 			}
 		      *pat = addrmem;
 		    }
+		  else
+		    {
+		      if (h_errno == NO_DATA)
+			result = -EAI_NODATA;
+		      else
+			result = -EAI_NONAME;
+		      goto free_and_return;
+		    }
 		}
 	      else
 		{