From: Ronnie Sahlberg Date: Wed, 29 May 2013 00:22:28 +0000 (-0700) Subject: Try making the initial port used a little more random X-Git-Tag: upstream/1.9.6^2~203 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=cb5b8be2eb2d5b6d837e9f1ae20001e186f4aac2;p=deb_libnfs.git Try making the initial port used a little more random --- diff --git a/lib/socket.c b/lib/socket.c index b14231e..699ed8a 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -401,8 +401,12 @@ static int rpc_connect_sockaddr_async(struct rpc_context *rpc, struct sockaddr_s static int portOfs = 0; const int firstPort = 512; /* >= 512 according to Sun docs */ const int portCount = IPPORT_RESERVED - firstPort; - int startOfs = portOfs, port, rc; + int startOfs, port, rc; + if (portOfs == 0) { + portOfs = time(NULL) % 400; + } + startOfs = portOfs; do { rc = -1; port = htons(firstPort + portOfs); diff --git a/win32build.bat b/win32build.bat index 35a3c30..388f3d3 100755 --- a/win32build.bat +++ b/win32build.bat @@ -65,26 +65,3 @@ cl /I. /Iwin32 /Iinclude/nfsc /Iinclude /Imount /Infs -Zi -Od -DWIN32 -D_WIN32_W - - - - - -.lib mswsock.lib advapi32.lib wsock32.lib advapi32.lib - - - - - - - - - - - - - - - - -