From: Ondřej Vašík <ovasik@redhat.com>
Date: Wed, 25 Feb 2009 14:41:55 +0000 (+0100)
Subject: test-getaddrinfo: fix usage of skip return code 77
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3de3a461b94515f6e6a3a9556ca24bb1c0e8ac91;p=pspp

test-getaddrinfo: fix usage of skip return code 77

* tests/test-gettaddrinfo.c: Return skip code 77 only
  for first occurance of skip (4x77 is not 77)

Signed-off-by: Simon Josefsson <simon@josefsson.org>
---

diff --git a/ChangeLog b/ChangeLog
index 3c3521a552..c0cd271731 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-25  Ondřej Vašík  <ovasik@redhat.com>
+
+	test-getaddrinfo: fix usage of skip return code 77
+	* tests/test-gettaddrinfo.c: Return skip code 77 only
+	  for first occurance of skip (4x77 is not 77)
+
 2009-02-25  Gary V. Vaughan  <gary@gnu.org>
 
 	strtod: avoid C99 decl-after-statement
diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index a8b2fd5d46..5e33bb24f1 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -45,10 +45,15 @@
 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;
 	}