From 4090d6a41f6babe4b265cf5bf8f6cc327564597a Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Sun, 30 Jan 2000 05:17:50 +0000 Subject: 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 --- lib/libc/net/rcmd.c | 13 +++++++++---- 1 file 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 @@ -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) -- cgit v1.2.3