diff options
Diffstat (limited to 'inet/rcmd.c')
-rw-r--r-- | inet/rcmd.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/inet/rcmd.c b/inet/rcmd.c index dd0fd35123..12081e8963 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -340,11 +340,9 @@ rresvport_af(alport, family) ss.__ss_family = family; for (;;) { - *sport = htons(i); - if (bind(s, (struct sockaddr *)&ss, len) >= 0){ - *alport = i; + *sport = htons((uint16_t) *alport); + if (bind(s, (struct sockaddr *)&ss, len) >= 0) return s; - } if (errno != EADDRINUSE) { (void)__close(s); return -1; |