From: Bill Stoddard Date: Thu, 17 Feb 2000 19:03:52 +0000 (+0000) Subject: Update Windows ap_filedup() call to recognise when it is asked to dup2 X-Git-Tag: 1.3.12~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e977c5c9ec41c4e7bbc4059d5a7eb8a0ef482bf;p=apache Update Windows ap_filedup() call to recognise when it is asked to dup2 a standard i/o handle. Return error if the dup2 handle is not one of the standard i/o handles (because Windows does not support a dup2 style function to operate on native file handles) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84638 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/log.c b/server/log.c index 08f6f77e5c..704ff6d4ab 100644 --- a/server/log.c +++ b/server/log.c @@ -264,18 +264,15 @@ void ap_open_logs(server_rec *s_main, ap_context_t *p) replace_stderr = 1; if (s_main->error_log) { + /* replace stderr with this new log */ #ifdef WIN32 + /* ToDo: Create ap_fflush() */ HANDLE hFile; ap_get_os_file(&hFile, s_main->error_log); FlushFileBuffers(hFile); - if (!SetStdHandle(STD_ERROR_HANDLE, hFile)) { - ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), s_main, - "unable to replace stderr with error_log"); - } - replace_stderr = 0; #else - /* replace stderr with this new log */ - fflush(stderr); /* ToDo: replace this with an APR call... */ + fflush(stderr); +#endif ap_open_stderr(&errfile, p); if ((rc = ap_dupfile(&errfile, s_main->error_log)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s_main, @@ -283,7 +280,6 @@ void ap_open_logs(server_rec *s_main, ap_context_t *p) } else { replace_stderr = 0; } -#endif } /* note that stderr may still need to be replaced with something * because it points to the old error log, or back to the tty