Use STDOUT/STDERR_FILENO in most of syslogger.
authorAndres Freund <andres@anarazel.de>
Tue, 19 Jul 2022 00:06:34 +0000 (17:06 -0700)
committerAndres Freund <andres@anarazel.de>
Tue, 19 Jul 2022 00:22:11 +0000 (17:22 -0700)
commit950e64fa46b164df87b5eb7c6e15213ab9880f87
tree784bae3f72aae3a321b1e59e9a7337edc90e603c
parentc290e79cf07f5784fd68e726177503a6805c28d6
Use STDOUT/STDERR_FILENO in most of syslogger.

This fixes problems on windows when logging collector is used in a service,
failing with:
FATAL:  could not redirect stderr: Bad file descriptor

This is triggered by 76e38b37a5. The problem is that STDOUT/STDERR_FILENO
aren't defined on windows, which lead us to use _fileno(stdout) etc, but that
doesn't work if stdout/stderr are closed.

Author: Andres Freund <andres@anarazel.de>
Reported-By: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
Message-Id: 20220520164558.ozb7lm6unakqzezi@alap3.anarazel.de (on pgsql-packagers)
Backpatch: 15-, where 76e38b37a5 came in
src/backend/postmaster/syslogger.c