diff options
author | Nathan Bossart <nathan@postgresql.org> | 2024-02-14 16:34:18 -0600 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2024-02-14 16:34:18 -0600 |
commit | 28e46325091dfac5c6ab9ea1e047a8d09dbd16e7 (patch) | |
tree | f48457af83f13b8bba8d600fe33aef1d39373e26 /src/backend/utils/misc/timeout.c | |
parent | 3b00fdba9f20b641d5d3c2b781cd435b23540e61 (diff) |
Centralize logic for restoring errno in signal handlers.
Presently, we rely on each individual signal handler to save the
initial value of errno and then restore it before returning if
needed. This is easily forgotten and, if missed, often goes
undetected for a long time.
In commit 3b00fdba9f, we introduced a wrapper signal handler
function that checks whether MyProcPid matches getpid(). This
commit moves the aforementioned errno restoration code from the
individual signal handlers to the new wrapper handler so that we no
longer need to worry about missing it.
Reviewed-by: Andres Freund, Noah Misch
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13
Diffstat (limited to 'src/backend/utils/misc/timeout.c')
-rw-r--r-- | src/backend/utils/misc/timeout.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/src/backend/utils/misc/timeout.c b/src/backend/utils/misc/timeout.c index aaaad8bb163..4055dd5f8d3 100644 --- a/src/backend/utils/misc/timeout.c +++ b/src/backend/utils/misc/timeout.c @@ -363,8 +363,6 @@ schedule_alarm(TimestampTz now) static void handle_sig_alarm(SIGNAL_ARGS) { - int save_errno = errno; - /* * Bump the holdoff counter, to make sure nothing we call will process * interrupts directly. No timeout handler should do that, but these @@ -452,8 +450,6 @@ handle_sig_alarm(SIGNAL_ARGS) } RESUME_INTERRUPTS(); - - errno = save_errno; } |