pgsql: Use STDOUT/STDERR_FILENO in most of syslogger.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use STDOUT/STDERR_FILENO in most of syslogger.
Date: 2022-07-19 00:53:47
Message-ID: E1oDbUg-000C9b-FX@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)anarazel(dot)de>
Reported-By: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
Message-Id: 20220520164558(dot)ozb7lm6unakqzezi(at)alap3(dot)anarazel(dot)de (on pgsql-packagers)
Backpatch: 15-, where 76e38b37a5 came in

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/950e64fa46b164df87b5eb7c6e15213ab9880f87

Modified Files
--------------
src/backend/postmaster/syslogger.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-07-19 01:55:37 pgsql: Add more tests for REINDEX DATABASE/SYSTEM with relfilenode chan
Previous Message Tom Lane 2022-07-18 23:43:26 pgsql: Improve perl style in ecpg's parser-construction scripts.