test-getaddrinfo: fix usage of skip return code 77
[gnulib.git] / tests / test-getaddrinfo.c
index a8b2fd5..5e33bb2 100644 (file)
 int simple (char *host, char *service)
 {
   char buf[BUFSIZ];
+  static int skip = 0;
   struct addrinfo hints;
   struct addrinfo *ai0, *ai;
   int res;
 
+  /* Once we skipped the test, do not try anything else */
+  if (skip)
+    return 0;
+
   dbgprintf ("Finding %s service %s...\n", host, service);
 
   /* This initializes "hints" but does not use it.  Is there a reason
@@ -69,6 +74,7 @@ int simple (char *host, char *service)
         in-law's farm. */
       if (res == EAI_AGAIN)
        {
+         skip++;
          fprintf (stderr, "skipping getaddrinfo test: no network?\n");
          return 77;
        }