[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getaddrinfo: test failure on Solaris 9

From: Paul Eggert
Subject: Re: getaddrinfo: test failure on Solaris 9
Date: Fri, 16 Nov 2007 13:22:38 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Further testing revealed that my previous fix wasn't right; sometimes
it works on Solaris, sometimes it doesn't, it's not worth our time to
figure out why.  So I installed the following fix instead: it causes
the test to ignore all failures of the kind observed on Solaris.

It does seem to me that the test is a bit dicey for other reasons,
e.g., suppose it's run on an isolated network that can't see

2007-11-16  Paul Eggert  <address@hidden>

        Port test-getaddrinfo to Solaris.
        Problem reported by Bruno Haible in
        * tests/test-getaddrinfo.c (simple): Add a comment asking for an
        explanation of setting 'hints'.
        Don't reject an implementation merely because it returns EAI_SERVICE.
        (EAI_SERVICE): Define to 0 if not defined.

diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index 4148788..7763f43 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -28,6 +28,10 @@
 # define AF_UNSPEC 0
+#ifndef EAI_SERVICE
+# define EAI_SERVICE 0
 int simple (char *host, char *service)
   char buf[BUFSIZ];
@@ -37,16 +41,26 @@ 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));
   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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]