pgsql: Windows: Make pg_ctl reliably detect service status

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Windows: Make pg_ctl reliably detect service status
Date: 2016-01-07 15:01:40
Message-ID: E1aHC4K-00057W-Mg@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Windows: Make pg_ctl reliably detect service status

pg_ctl is using isatty() to verify whether the process is running in a
terminal, and if not it sends its output to Windows' Event Log ... which
does the wrong thing when the output has been redirected to a pipe, as
reported in bug #13592.

To fix, make pg_ctl use the code we already have to detect service-ness:
in the master branch, move src/backend/port/win32/security.c to src/port
(with suitable tweaks so that it runs properly in backend and frontend
environments); pg_ctl already has access to pgport so it Just Works. In
older branches, that's likely to cause trouble, so instead duplicate the
required code in pg_ctl.c.

Author: Michael Paquier
Bug report and diagnosis: Egon Kocjan
Backpatch: all supported branches

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a967613911f7ef7b6387b9e8718f0ab8f0c4d9c8

Modified Files
--------------
src/backend/port/win32/Makefile | 2 +-
src/backend/port/win32/security.c | 248 --------------------------------
src/bin/pg_ctl/pg_ctl.c | 2 +-
src/include/port/win32.h | 7 +-
src/port/win32security.c | 282 +++++++++++++++++++++++++++++++++++++
src/tools/msvc/Mkvcbuild.pm | 2 +-
6 files changed, 289 insertions(+), 254 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-01-07 16:19:39 pgsql: Provide more detail in postmaster log for password authenticatio
Previous Message Tom Lane 2016-01-06 17:25:38 pgsql: In initdb's post-bootstrap phase, drop temp tables explicitly.

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-01-07 15:05:32 Re: checkpointer continuous flushing
Previous Message Jim Nasby 2016-01-07 14:50:50 Re: Very confusing installcheck behavior with PGXS