* net.cc (cygwin_setsockopt): Only skip calling setsockopt(SO_REUSEADDR)

on stream sockets under systems supporting enhanced socket security.
This commit is contained in:
Corinna Vinschen 2009-12-15 17:08:20 +00:00
parent f04f6d49fa
commit 2f5d8f7bd0
2 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2009-12-15 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_setsockopt): Only skip calling setsockopt(SO_REUSEADDR)
on stream sockets under systems supporting enhanced socket security.
2009-12-15 Thomas Wolff <towo@towo.net> 2009-12-15 Thomas Wolff <towo@towo.net>
* fhandler_console.cc (char_command): Fix code to select dim mode * fhandler_console.cc (char_command): Fix code to select dim mode

View File

@ -693,11 +693,12 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
optname = convert_ws1_ip_optname (optname); optname = convert_ws1_ip_optname (optname);
/* On systems supporting "enhanced socket security (2K3 and later), /* On systems supporting "enhanced socket security (2K3 and later),
the default behaviour of socket binding is equivalent to the POSIX the default behaviour of stream socket binding is equivalent to the
behaviour with SO_REUSEADDR. Setting SO_REUSEADDR would only result POSIX behaviour with SO_REUSEADDR. Setting SO_REUSEADDR would only
in wrong behaviour. See also fhandler_socket::bind(). */ result in wrong behaviour. See also fhandler_socket::bind(). */
if (level == SOL_SOCKET && optname == SO_REUSEADDR if (level == SOL_SOCKET && optname == SO_REUSEADDR
&& wincap.has_enhanced_socket_security ()) && wincap.has_enhanced_socket_security ()
&& fh->get_socket_type () == SOCK_STREAM)
res = 0; res = 0;
else else
res = setsockopt (fh->get_socket (), level, optname, res = setsockopt (fh->get_socket (), level, optname,