Restore code for closing inherited file descriptors under non-OS X.

The code for doing this was accidentally disabled in r74957, which intended to
disable it for Darwin, but ended up disabling it for everything but Darwin.

Reenable it for all platforms now, clearly it didn't hurt to have it enabled
under Darwin, and we do need to do it, e.g. see #12636.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78086 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-11-01 14:00:04 +00:00
parent 844159792f
commit 7e96398e63

View File

@@ -687,7 +687,6 @@ long wxExecute(char **argv, int flags, wxProcess *process,
// the descriptors do not need to be closed but for now this is better
// than never closing them at all as wx code never used FD_CLOEXEC.
#ifdef __DARWIN__
// TODO: Iterating up to FD_SETSIZE is both inefficient (because it may
// be quite big) and incorrect (because in principle we could
// have more opened descriptions than this number). Unfortunately
@@ -695,14 +694,6 @@ long wxExecute(char **argv, int flags, wxProcess *process,
// above a certain threshold but non-portable solutions exist for
// most platforms, see [http://stackoverflow.com/questions/899038/
// getting-the-highest-allocated-file-descriptor]
//
// Unfortunately, we cannot do this safely on OS X, because libdispatch
// may crash when we do this:
// Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
// Exception Codes: 0x0000000000000001, 0x0000000000000000
//
// Application Specific Information:
// BUG IN CLIENT OF LIBDISPATCH: Do not close random Unix descriptors
for ( int fd = 0; fd < (int)FD_SETSIZE; ++fd )
{
if ( fd != STDIN_FILENO &&
@@ -712,7 +703,6 @@ long wxExecute(char **argv, int flags, wxProcess *process,
close(fd);
}
}
#endif // !__DARWIN__
// Process additional options if we have any