diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-06-24 13:13:44 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-06-24 13:13:44 +0000 |
commit | 7b3e3bfd49bef27c5df703e9c079c0c1eb454ecc (patch) | |
tree | 2738ce15cc47141ea0acec86e190975d6a7fb650 | |
parent | 6b9b8ecd853a1a01fd7650a48b4dd842bbaecdc9 (diff) | |
download | newlib-7b3e3bfd49bef27c5df703e9c079c0c1eb454ecc.zip newlib-7b3e3bfd49bef27c5df703e9c079c0c1eb454ecc.tar.gz newlib-7b3e3bfd49bef27c5df703e9c079c0c1eb454ecc.tar.bz2 |
* net.cc (cygwin_bindresvport_sa): Fix usage of last_used_bindresvport.
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/net.cc | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 5c818f6..9eecb64 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2008-06-24 Corinna Vinschen <corinna@vinschen.de> + + * net.cc (cygwin_bindresvport_sa): Fix usage of last_used_bindresvport. + 2008-06-21 Corinna Vinschen <corinna@vinschen.de> * include/limits.h (PATH_MAX): Add comment. diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index c18a775..7e9d14c 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2219,9 +2219,9 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa) for (int i = 0; i < NUM_PORTS; i++) { - while ((myport = InterlockedExchange (&cygwin_shared->last_used_bindresvport, 0)) == 0) + while ((myport = InterlockedExchange (&cygwin_shared->last_used_bindresvport, -1)) == -1) low_priority_sleep (0); - if (--myport < PORT_LOW) + if (myport == 0 || --myport < PORT_LOW) myport = PORT_HIGH; InterlockedExchange (&cygwin_shared->last_used_bindresvport, myport); |