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
This commit is contained in:
shin 2000-02-10 19:46:47 +00:00
parent 744d6ea72f
commit 3932191dfc

View File

@ -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);