Port test-getaddrinfo to Solaris.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Nov 2007 19:18:36 +0000 (11:18 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Nov 2007 19:18:36 +0000 (11:18 -0800)
Problem reported by Bruno Haible in
<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.

ChangeLog
tests/test-getaddrinfo.c

index ecea8e2..1ea7dc9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-11-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port test-getaddrinfo to Solaris.
+       Problem reported by Bruno Haible in
+       <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.
+
 2007-11-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        The license of gnu-make and posix-shell is now "GPLed build tool".
index 4148788..0624516 100644 (file)
@@ -37,10 +37,13 @@ int simple (char *host, char *service)
 
   printf ("Finding %s service %s...\n", host, service);
 
+  /* This initializes "hints" but does not use it.  Is there a reason
+     for this?  If so, please fix this comment.  */
   memset (&hints, 0, sizeof (hints));
   hints.ai_flags = AI_CANONNAME;
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
+
   res = getaddrinfo (host, service, 0, &ai0);
 
   printf ("res %d: %s\n", res, gai_strerror (res));
@@ -86,12 +89,15 @@ int simple (char *host, char *service)
   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 "http"
+#define SERV1 "80"
 #define HOST2 "www.ibm.com"
-#define SERV2 "https"
+#define SERV2 "443"
 #define HOST3 "microsoft.com"
-#define SERV3 "http"
+#define SERV3 "80"
 #define HOST4 "google.org"
 #define SERV4 "ldap"