Subject: Collected Debian patches for remctl
Author: Russ Allbery <rra@debian.org>

Since I am also upstream for this package, there will normally not be any
patches to apply to the upstream source.  However, occasionally I'll pull
up specific upstream commits prior to making an upstream release.  When
this happens, this patch will collect all of those modifications.

I use Git to maintain both the upstream source and the Debian packages,
and generating individual patches rather than using git cherry-pick takes
extra work for no gain.  Since I'm also upstream, there's no need to
separate the patches for later upstream submission.  Hence, I take this
approach with a unified patch when it's necessary.

For full commit history and separated commits, see the upstream Git
repsitory.
--- remctl-3.0.orig/tests/portable/getaddrinfo-t.c
+++ remctl-3.0/tests/portable/getaddrinfo-t.c
@@ -236,7 +236,10 @@ main(void)
         skip("lookup of addrinfo-test.invalid succeeded");
     else {
         result = test_getaddrinfo("addrinfo-test.invalid", NULL, NULL, &ai);
-        is_int(EAI_NONAME, result, "lookup of invalid address");
+        if (result == EAI_AGAIN || result == EAI_FAIL)
+            skip("lookup of invalid address returns DNS failure");
+        else
+            is_int(EAI_NONAME, result, "lookup of invalid address");
     }
 
     host = gethostbyname("cnn.com");
--- remctl-3.0.orig/tests/util/network-t.c
+++ remctl-3.0/tests/util/network-t.c
@@ -410,7 +410,7 @@ test_timeout_ipv4(void)
         _exit(0);
     } else {
         socket_type block[20];
-        int i;
+        int i, err;
 
         close(fd);
         c = network_connect_host("127.0.0.1", 11119, NULL, 1);
@@ -427,14 +427,23 @@ test_timeout_ipv4(void)
             if (block[i] == INVALID_SOCKET)
                 break;
         }
-        diag("Finally timed out on socket %d", i);
-        ok(block[i] == INVALID_SOCKET, "Timeout: later connection timed out");
-        is_int(ETIMEDOUT, socket_errno, "...with correct error");
+        err = socket_errno;
+        if (i == ARRAY_SIZE(block))
+            skip_block(2, "short listen queue does not prevent connections");
+        else {
+            diag("Finally timed out on socket %d", i);
+            ok(block[i] == INVALID_SOCKET, "Later connection timed out");
+            if (err == ECONNRESET)
+                skip("connections rejected without timeout");
+            else
+                skip("error code would have been %d (ETIMEDOUT: %d)", err,
+                     ETIMEDOUT);
+        }
         alarm(0);
         kill(child, SIGTERM);
         waitpid(child, NULL, 0);
         close(c);
-        for (; i >= 0; i--)
+        for (i--; i >= 0; i--)
             if (block[i] != INVALID_SOCKET)
                 close(block[i]);
     }
