changeset 29172:117083e4a21a

Port test-getaddrinfo to Solaris (fixed version; previous change was wrong).
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 16 Nov 2007 13:16:27 -0800
parents 7b64947964c4
children eda839313dbd
files ChangeLog tests/test-getaddrinfo.c
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Nov 16 11:18:36 2007 -0800
+++ b/ChangeLog	Fri Nov 16 13:16:27 2007 -0800
@@ -5,8 +5,8 @@
 	<http://lists.gnu.org/archive/html/bug-gnulib/2007-03/msg00171.html>.
 	* tests/test-getaddrinfo.c (simple): Add a comment asking for an
 	explanation of setting 'hints'.
-	(SERV1, SERV2, SERV3): Don't use "http" and "https"; this doesn't
-	work in Solaris 10 and earlier.
+	Don't reject an implementation merely because it returns EAI_SERVICE.
+	(EAI_SERVICE): Define to 0 if not defined.
 
 2007-11-15  Paul Eggert  <eggert@cs.ucla.edu>
 
--- a/tests/test-getaddrinfo.c	Fri Nov 16 11:18:36 2007 -0800
+++ b/tests/test-getaddrinfo.c	Fri Nov 16 13:16:27 2007 -0800
@@ -28,6 +28,10 @@
 # define AF_UNSPEC 0
 #endif
 
+#ifndef EAI_SERVICE
+# define EAI_SERVICE 0
+#endif
+
 int simple (char *host, char *service)
 {
   char buf[BUFSIZ];
@@ -49,7 +53,14 @@
   printf ("res %d: %s\n", res, gai_strerror (res));
 
   if (res != 0)
-    return 1;
+    {
+      /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
+         fail the test merely because of this.  */
+      if (res == EAI_SERVICE)
+	return 0;
+
+      return 1;
+    }
 
   for (ai = ai0; ai; ai = ai->ai_next)
     {
@@ -89,15 +100,12 @@
   return 0;
 }
 
-/* Use numbers for http and https services, rather than names, because
-   Solaris 8 /etc/services does not define these service names by
-   default.  */
 #define HOST1 "www.gnu.org"
-#define SERV1 "80"
+#define SERV1 "http"
 #define HOST2 "www.ibm.com"
-#define SERV2 "443"
+#define SERV2 "https"
 #define HOST3 "microsoft.com"
-#define SERV3 "80"
+#define SERV3 "http"
 #define HOST4 "google.org"
 #define SERV4 "ldap"