summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/net/rcmd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 79892bd5a1b..3cd3029a03d 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rcmd.c,v 1.33 2000/01/27 05:18:47 itojun Exp $";
+static char *rcsid = "$OpenBSD: rcmd.c,v 1.34 2000/01/30 05:17:49 itojun Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -140,9 +140,14 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
else
(void)fprintf(stderr, "rcmd: socket: %s\n",
strerror(errno));
- sigsetmask(oldmask);
- freeaddrinfo(res);
- return (-1);
+ if (r->ai_next) {
+ r = r->ai_next;
+ continue;
+ } else {
+ sigsetmask(oldmask);
+ freeaddrinfo(res);
+ return (-1);
+ }
}
fcntl(s, F_SETOWN, pid);
if (connect(s, r->ai_addr, r->ai_addrlen) >= 0)