OSDN Git Service

Avoid a potentially undefined operation with a veriable++ in a macro
authorEric Andersen <andersen@codepoet.org>
Tue, 2 Dec 2003 17:58:24 +0000 (17:58 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 2 Dec 2003 17:58:24 +0000 (17:58 -0000)
libc/inet/rpc/bindresvport.c

index 7dcebe7..579f17b 100644 (file)
@@ -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;
        }