summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/inet/rpc/bindresvport.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c
index 7dcebe7dc..579f17be7 100644
--- a/libc/inet/rpc/bindresvport.c
+++ b/libc/inet/rpc/bindresvport.c
@@ -76,8 +76,8 @@ bindresvport (int sd, struct sockaddr_in *sin)
for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; ++i)
{
- sin->sin_port = htons (port++);
- if (port > ENDPORT)
+ sin->sin_port = htons (port);
+ if (++port > ENDPORT)
{
port = STARTPORT;
}