diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-09-28 20:57:11 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-09-28 20:57:11 +0000 |
commit | 78c49507227fdb15ad6fd88feac631ebb49cc451 (patch) | |
tree | 3b109e686db9d3e769fb696a7030a2fcae8dae1b /file_io/win32/open.c | |
parent | 0520ee6743210b627aa64c881a779aa36f5fa37c (diff) | |
download | libapr-78c49507227fdb15ad6fd88feac631ebb49cc451.tar.gz |
Introduce APR_NO_FILE as an option for any of the three stdio streams
to cause the specified streams to be closed to the child process,
when the caller has chosen that flag via apr_procattr_io_set().
This is the nonportable flavor targeting 1.2.12; unix 1.3.0 specific
commit to follow.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@580484 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/win32/open.c')
-rw-r--r-- | file_io/win32/open.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/file_io/win32/open.c b/file_io/win32/open.c index f81c9c80e..0d8f88d1b 100644 --- a/file_io/win32/open.c +++ b/file_io/win32/open.c @@ -550,8 +550,7 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, /* ### check return codes */ (void) apr_pollset_create(&(*file)->pollset, 1, pool, 0); - /* XXX... we pcalloc above so all others are zeroed. - * Should we be testing if thefile is a handle to + /* Should we be testing if thefile is a handle to * a PIPE and set up the mechanics appropriately? * * (*file)->pipe; @@ -578,15 +577,11 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile, apr_set_os_error(APR_SUCCESS); file_handle = GetStdHandle(STD_ERROR_HANDLE); - if (!file_handle || (file_handle == INVALID_HANDLE_VALUE)) { - apr_status_t rv = apr_get_os_error(); - if (rv == APR_SUCCESS) { - return APR_EINVAL; - } - return rv; - } + if (!file_handle) + file_handle = INVALID_HANDLE_VALUE; - return apr_os_file_put(thefile, &file_handle, flags | APR_WRITE, pool); + return apr_os_file_put(thefile, &file_handle, + flags | APR_WRITE | APR_STDERR_FLAG, pool); #endif } @@ -601,15 +596,11 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile, apr_set_os_error(APR_SUCCESS); file_handle = GetStdHandle(STD_OUTPUT_HANDLE); - if (!file_handle || (file_handle == INVALID_HANDLE_VALUE)) { - apr_status_t rv = apr_get_os_error(); - if (rv == APR_SUCCESS) { - return APR_EINVAL; - } - return rv; - } + if (!file_handle) + file_handle = INVALID_HANDLE_VALUE; - return apr_os_file_put(thefile, &file_handle, flags | APR_WRITE, pool); + return apr_os_file_put(thefile, &file_handle, + flags | APR_WRITE | APR_STDOUT_FLAG, pool); #endif } @@ -624,15 +615,11 @@ APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile, apr_set_os_error(APR_SUCCESS); file_handle = GetStdHandle(STD_INPUT_HANDLE); - if (!file_handle || (file_handle == INVALID_HANDLE_VALUE)) { - apr_status_t rv = apr_get_os_error(); - if (rv == APR_SUCCESS) { - return APR_EINVAL; - } - return rv; - } + if (!file_handle) + file_handle = INVALID_HANDLE_VALUE; - return apr_os_file_put(thefile, &file_handle, flags | APR_READ, pool); + return apr_os_file_put(thefile, &file_handle, + flags | APR_READ | APR_STDIN_FLAG, pool); #endif } |