summaryrefslogtreecommitdiffstats
path: root/bsd-bindresvport.c
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 /bsd-bindresvport.c
parente219273f93fe94aa188591803be5b9a71afc338a (diff)
- Fix rresvport_af failure errors (logic error in bsd-bindresvport.c)
Diffstat (limited to 'bsd-bindresvport.c')
-rw-r--r--bsd-bindresvport.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bsd-bindresvport.c b/bsd-bindresvport.c
index 0e91d265..04780673 100644
--- a/bsd-bindresvport.c
+++ b/bsd-bindresvport.c
@@ -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;