diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2023-01-23 02:19:32 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2023-05-03 23:11:34 -0400 |
commit | 7553c09da980845eb5b03d286ee4c4bf247e6eae (patch) | |
tree | fc6a80e7a6174b77e069a6a0a1950c7aab74836e /src/fdlog_maint.c | |
parent | 57d40773c2c299a9038985fb1f73d691a3ceef39 (diff) | |
download | lighttpd-git-7553c09da980845eb5b03d286ee4c4bf247e6eae.tar.gz |
[core] _WIN32 reset std streams at startup
Diffstat (limited to 'src/fdlog_maint.c')
-rw-r--r-- | src/fdlog_maint.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fdlog_maint.c b/src/fdlog_maint.c index 13bfd1dc..fdf8f7fe 100644 --- a/src/fdlog_maint.c +++ b/src/fdlog_maint.c @@ -8,6 +8,9 @@ #include <stdlib.h> #include <string.h> #include "sys-unistd.h" /* <unistd.h> */ +#ifdef _WIN32 +#include <windows.h> +#endif #include "fdevent.h" #include "ck.h" @@ -155,6 +158,9 @@ fdlog_pipe_serrh (const int fd) if (fdlog->fd != fd) continue; fdlog->fd = STDERR_FILENO; + #ifdef _WIN32 + SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(STDERR_FILENO)); + #endif break; } } @@ -279,6 +285,10 @@ fdlog_files_cycle (fdlog_st * const errh) log_perror(errh, __FILE__, __LINE__, "dup2() %s to %d", fdlog->fn, fdlog->fd); close(fd); + #ifdef _WIN32 + SetStdHandle(STD_ERROR_HANDLE, + (HANDLE)_get_osfhandle(STDERR_FILENO)); + #endif } } else { |