From 013e402bfc6d661d5884cd65888be06fa6e19c4f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 23 Nov 2009 12:21:39 +0000 Subject: [PATCH] * fhandler_socket.cc (fhandler_socket::set_close_on_exec): Only call fhandler_base::set_close_on_exec for inheritable sockets. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/fhandler_socket.cc | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 529daa296..ab6cf6fca 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-11-23 Corinna Vinschen + + * fhandler_socket.cc (fhandler_socket::set_close_on_exec): Only call + fhandler_base::set_close_on_exec for inheritable sockets. + 2009-11-21 Corinna Vinschen * globals.cc (ro_u_dll): New R/O unicode string. diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 6a6620686..ba230dff1 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -2034,8 +2034,13 @@ fhandler_socket::set_close_on_exec (bool val) { set_no_inheritance (wsock_mtx, val); set_no_inheritance (wsock_evt, val); - fhandler_base::set_close_on_exec (val); - debug_printf ("set close_on_exec for %s to %d", get_name (), val); + if (need_fixup_before ()) + { + close_on_exec (val); + debug_printf ("set close_on_exec for %s to %d", get_name (), val); + } + else + fhandler_base::set_close_on_exec (val); } void