From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid calling pqsignal() with invalid signals on Windows fronten
Date: Thu, 16 Jan 2025 21:58:12 +0000
Message-ID: <E1tYXsS-001ymr-1Z@gemulon.postgresql.org> (raw)
Avoid calling pqsignal() with invalid signals on Windows frontends.
As noted by the comment at the top of port/pqsignal.c, Windows
frontend programs can only use pqsignal() with the 6 signals
required by C. Most places avoid using invalid signals via #ifndef
WIN32, but initdb and pg_test_fsync check whether the signal itself
is defined, which doesn't work because win32_port.h defines many
extra signals for the signal emulation code. pg_regress seems to
have missed the memo completely. These issues aren't causing any
real problems today because nobody checks the return value of
pqsignal(), but a follow-up commit will add some error checking.
To fix, surround all frontend calls to pqsignal() that use signals
that are invalid on Windows with #ifndef WIN32. We cannot simply
skip defining the extra signals in win32_port.h for frontends
because they are needed in places such as pgkill().
Reviewed-by: Thomas Munro
Discussion: https://postgr.es/m/Z4chOKfnthRH71mw%40nathan
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5cda4fdb0beb64453b634d0ab966912965c7b8f6
Modified Files
--------------
src/bin/initdb/initdb.c | 19 +++++--------------
src/bin/pg_test_fsync/pg_test_fsync.c | 5 ++---
src/test/regress/pg_regress.c | 8 ++++++--
3 files changed, 13 insertions(+), 19 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Avoid calling pqsignal() with invalid signals on Windows fronten
In-Reply-To: <E1tYXsS-001ymr-1Z@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox