diff options
author | shin <shin@FreeBSD.org> | 2000-02-10 19:46:47 +0000 |
---|---|---|
committer | shin <shin@FreeBSD.org> | 2000-02-10 19:46:47 +0000 |
commit | 4d04714b75d40c923da221678a9e459e9a39c048 (patch) | |
tree | 3f233a785ba842675c4bc3d4fbd3c80456ef365a /lib/libc/net/rcmd.c | |
parent | 45bda4b5304e92e11573063a453874bc9d16a306 (diff) | |
download | FreeBSD-src-4d04714b75d40c923da221678a9e459e9a39c048.zip FreeBSD-src-4d04714b75d40c923da221678a9e459e9a39c048.tar.gz |
Add more dual stack consideration.
-Should not error return when rresvport_af() failed for one of dest
addrs resolved by getaddrinfo().
Should retry until all dest addr fail.
Approved by: jkh
Diffstat (limited to 'lib/libc/net/rcmd.c')
-rw-r--r-- | lib/libc/net/rcmd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c index 63ea58f..5bbef4b 100644 --- a/lib/libc/net/rcmd.c +++ b/lib/libc/net/rcmd.c @@ -127,14 +127,18 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) for (timo = 1, lport = IPPORT_RESERVED - 1;;) { s = rresvport_af(&lport, ai->ai_family); if (s < 0) { + if (errno != EAGAIN && ai->ai_next) { + ai = ai->ai_next; + continue; + } if (errno == EAGAIN) (void)fprintf(stderr, "rcmd: socket: All ports in use\n"); else (void)fprintf(stderr, "rcmd: socket: %s\n", strerror(errno)); - sigsetmask(oldmask); freeaddrinfo(res); + sigsetmask(oldmask); return (-1); } _fcntl(s, F_SETOWN, pid); |