summaryrefslogtreecommitdiff
path: root/src/port/pqsignal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/port/pqsignal.c')
-rw-r--r--src/port/pqsignal.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/port/pqsignal.c b/src/port/pqsignal.c
index 92382b3c348..6ca2d4e20a8 100644
--- a/src/port/pqsignal.c
+++ b/src/port/pqsignal.c
@@ -80,10 +80,14 @@ static volatile pqsigfunc pqsignal_handlers[PG_NSIG];
* processes do not modify shared memory, which is often detrimental. If the
* check succeeds, the function originally provided to pqsignal() is called.
* Otherwise, the default signal handler is installed and then called.
+ *
+ * This wrapper also handles restoring the value of errno.
*/
static void
wrapper_handler(SIGNAL_ARGS)
{
+ int save_errno = errno;
+
#ifndef FRONTEND
/*
@@ -102,6 +106,8 @@ wrapper_handler(SIGNAL_ARGS)
#endif
(*pqsignal_handlers[postgres_signal_arg]) (postgres_signal_arg);
+
+ errno = save_errno;
}
/*