Browse Source

Avoid a potentially undefined operation with a veriable++ in a macro

Eric Andersen 20 years ago
parent
commit
a2fa33e700
1 changed files with 2 additions and 2 deletions
  1. 2 2
      libc/inet/rpc/bindresvport.c

+ 2 - 2
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;
 	}