- Fix rresvport_af failure errors (logic error in bsd-bindresvport.c)
This commit is contained in:
parent
e219273f93
commit
19fe9c7fd8
|
@ -6,9 +6,11 @@
|
|||
- Document location of Redhat PAM file in INSTALL.
|
||||
- Fixed X11 forwarding bug on Linux. libc advertises AF_INET6
|
||||
INADDR_ANY_INIT addresses via getaddrinfo, but may not be able to
|
||||
deliver (no IPv6 kernel kernel support)
|
||||
deliver (no IPv6 kernel support)
|
||||
- Released 1.2.1pre27
|
||||
|
||||
- Fix rresvport_af failure errors (logic error in bsd-bindresvport.c)
|
||||
|
||||
20000116
|
||||
- Renamed --with-xauth-path to --with-xauth
|
||||
- Added --with-pid-dir option
|
||||
|
|
|
@ -84,17 +84,17 @@ bindresvport_af(sd, sa, af)
|
|||
sa->sa_family = af;
|
||||
|
||||
if (*portp == 0)
|
||||
*portp = (arc4random() % NPORTS) + STARTPORT;
|
||||
*portp = (u_int16_t)(arc4random() % NPORTS) + STARTPORT;
|
||||
|
||||
for(i = 0; i < NPORTS; i++) {
|
||||
error = bind(sd, sa, salen);
|
||||
|
||||
|
||||
/* Terminate on success */
|
||||
if (error == 0)
|
||||
break;
|
||||
|
||||
/* Terminate on errors, except "address already in use" */
|
||||
if ((error < 0) && ((errno != EADDRINUSE) || (errno != EINVAL)))
|
||||
if ((error < 0) && !((errno == EADDRINUSE) || (errno == EINVAL)))
|
||||
break;
|
||||
|
||||
*portp = (i % NPORTS) + STARTPORT;
|
||||
|
|
Loading…
Reference in New Issue