pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Convert libpgport's pqsignal() to a void function.
Date: Thu, 16 Jan 2025 22:42:54 +0000
Message-ID: <E1tYYZi-001z2O-Fz@gemulon.postgresql.org> (raw)

Convert libpgport's pqsignal() to a void function.

The protections added by commit 3b00fdba9f introduced race
conditions to this function that can lead to bogus return values.
Since nobody seems to inspect the return value, this is of little
consequence, but it would have been nice to convert it to a void
function to avoid any possibility of a bogus return value.  I
originally thought that doing so would have required also modifying
legacy-pqsignal.c's version of the function (which would've
required an SONAME bump), but commit 9a45a89c38 gave
legacy-pqsignal.c its own dedicated extern for pqsignal(), thereby
decoupling it enough that libpgport's pqsignal() can be modified.

This commit also adds an assertion for the return value of
sigaction()/signal().  Since a failure most likely indicates a
coding error, and nobody has ever bothered to check pqsignal()'s
return value, it's probably not worth the effort to do anything
fancier.

Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/Z4chOKfnthRH71mw%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d4a43b283751b23d32bbfa1ecc2cad2d16e3dde9

Modified Files
--------------
src/include/port.h  |  2 +-
src/port/pqsignal.c | 34 ++++++----------------------------
2 files changed, 7 insertions(+), 29 deletions(-)



Message-ID: <E1tYYZi-001z2O-Fz@gemulon.postgresql.org>
Permalink:  ../E1tYYZi-001z2O-Fz@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tYYZi-001z2O-Fz@gemulon.postgresql.org

 · 

reply

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: Convert libpgport's pqsignal() to a void function.
  In-Reply-To: <E1tYYZi-001z2O-Fz@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