summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-01-17 15:23:01 +1100
committerDamien Miller <djm@mindrot.org>2000-01-17 15:23:01 +1100
commit19fe9c7fd8e4a0e68f943f86b8164683fe327479 (patch)
tree404c99566de33d2cce89003b8a9bd766cb0eccb2
parente219273f93fe94aa188591803be5b9a71afc338a (diff)
- Fix rresvport_af failure errors (logic error in bsd-bindresvport.c)
-rw-r--r--ChangeLog4
-rw-r--r--bsd-bindresvport.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5cd8348ff..5ea5c0188 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,9 +6,11 @@
6 - Document location of Redhat PAM file in INSTALL. 6 - Document location of Redhat PAM file in INSTALL.
7 - Fixed X11 forwarding bug on Linux. libc advertises AF_INET6 7 - Fixed X11 forwarding bug on Linux. libc advertises AF_INET6
8 INADDR_ANY_INIT addresses via getaddrinfo, but may not be able to 8 INADDR_ANY_INIT addresses via getaddrinfo, but may not be able to
9 deliver (no IPv6 kernel kernel support) 9 deliver (no IPv6 kernel support)
10 - Released 1.2.1pre27 10 - Released 1.2.1pre27
11 11
12 - Fix rresvport_af failure errors (logic error in bsd-bindresvport.c)
13
1220000116 1420000116
13 - Renamed --with-xauth-path to --with-xauth 15 - Renamed --with-xauth-path to --with-xauth
14 - Added --with-pid-dir option 16 - Added --with-pid-dir option
diff --git a/bsd-bindresvport.c b/bsd-bindresvport.c
index 0e91d2658..04780673b 100644
--- a/bsd-bindresvport.c
+++ b/bsd-bindresvport.c
@@ -84,17 +84,17 @@ bindresvport_af(sd, sa, af)
84 sa->sa_family = af; 84 sa->sa_family = af;
85 85
86 if (*portp == 0) 86 if (*portp == 0)
87 *portp = (arc4random() % NPORTS) + STARTPORT; 87 *portp = (u_int16_t)(arc4random() % NPORTS) + STARTPORT;
88 88
89 for(i = 0; i < NPORTS; i++) { 89 for(i = 0; i < NPORTS; i++) {
90 error = bind(sd, sa, salen); 90 error = bind(sd, sa, salen);
91 91
92 /* Terminate on success */ 92 /* Terminate on success */
93 if (error == 0) 93 if (error == 0)
94 break; 94 break;
95 95
96 /* Terminate on errors, except "address already in use" */ 96 /* Terminate on errors, except "address already in use" */
97 if ((error < 0) && ((errno != EADDRINUSE) || (errno != EINVAL))) 97 if ((error < 0) && !((errno == EADDRINUSE) || (errno == EINVAL)))
98 break; 98 break;
99 99
100 *portp = (i % NPORTS) + STARTPORT; 100 *portp = (i % NPORTS) + STARTPORT;