diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-08-28 04:43:39 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-08-28 04:43:39 +0000 |
commit | 8c9b175a483cf93dd12258b7378578e62c05d52e (patch) | |
tree | 9f2791f21f19ac6aa47e02b05390703f3c3b9956 /file_io | |
parent | 4d3a2a43b28f6ecb4cc90abd09bc036577390705 (diff) | |
download | libapr-8c9b175a483cf93dd12258b7378578e62c05d52e.tar.gz |
Solve win32 inherited pipe leaks by leveraging OS2 port's solution.
Mutex the pipe manipulation on WinNT+++ alone (not WinCE, nor 9x)
so that we toggle the inherited state of the stdin/out/err pipes.
This is only possible on NT, because in CE/9x it would involve
replacing the pipe handles all over the place as there is no toggle.
This CRITICAL_SECTION pipe is incredibly fast in the mainline case,
and only introduces contention in the threaded server after startup
(for cgi, etc). Not unlike an in-process cgid.
So, leave WinCE alone for now, since it doesn't follow the stdio model,
and leave Win9x alone for good, as nearly abandoned.
Backport: r569882 (+r569890)
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@570304 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r-- | file_io/win32/pipe.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/file_io/win32/pipe.c b/file_io/win32/pipe.c index e26c29680..78d6b096e 100644 --- a/file_io/win32/pipe.c +++ b/file_io/win32/pipe.c @@ -95,7 +95,15 @@ apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, char name[50]; sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; + +#if APR_HAS_UNICODE_FS + IF_WIN_OS_IS_UNICODE + sa.bInheritHandle = FALSE; +#endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI + sa.bInheritHandle = TRUE; +#endif sa.lpSecurityDescriptor = NULL; (*in) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t)); |