summaryrefslogtreecommitdiff
path: root/lib/libc/net/rcmd.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-01-30 05:17:50 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-01-30 05:17:50 +0000
commit4090d6a41f6babe4b265cf5bf8f6cc327564597a (patch)
tree61824a3dd7ce22a27a208b392573b2595fe91ec5 /lib/libc/net/rcmd.c
parentd291a1fc70102da39f165618d208f5e8cba86817 (diff)
visit next addrinfo structure when rresvport_af() fails.
this should fix situation like: - try to rcmd() to dual stack node from IPv4-only node/kernel
Diffstat (limited to 'lib/libc/net/rcmd.c')
-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)