1 2005-11-21 Jakub Jelinek <jakub@redhat.com>
3 * sunrpc/bindrsvprt.c (bindresvport): Wrap around to startport
4 in the loop if port is bigger than endport, initially set to
5 ENDPORT. When changing startport, set endport and port
8 --- libc/sunrpc/bindrsvprt.c 23 May 2005 19:03:43 -0000 1.11
9 +++ libc/sunrpc/bindrsvprt.c 22 Nov 2005 04:39:05 -0000 1.12
10 @@ -74,14 +74,13 @@ bindresvport (int sd, struct sockaddr_in
13 int nports = ENDPORT - startport + 1;
14 + int endport = ENDPORT;
16 for (i = 0; i < nports; ++i)
18 sin->sin_port = htons (port++);
25 res = __bind (sd, sin, sizeof (struct sockaddr_in));
26 if (res >= 0 || errno != EADDRINUSE)
28 @@ -90,7 +89,9 @@ bindresvport (int sd, struct sockaddr_in
29 if (i == nports && startport != LOWPORT)
32 + endport = STARTPORT - 1;
33 nports = STARTPORT - LOWPORT;
34 + port = LOWPORT + port % (STARTPORT - LOWPORT);