pgpool2.git / summary / log / commit / refs
commit 89738285251dbb5a57cc1748a7c94bd4f78124f9
Author: Tatsuo Ishii <ishii@sraoss.co.jp>
Date: Tue Oct 12 01:40:11 2021 +0000
Fix signal handler for SIGTERM, SIGINT and SIGQUIT.
It did not properly save errno and it was possible to overwrite errno.
src/protocol/child.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/protocol/child.c b/src/protocol/child.c
index c4a432ee7..f49c5ea26 100644
--- a/src/protocol/child.c
+++ b/src/protocol/child.c
@@ -1076,10 +1076,10 @@ static RETSIGTYPE die(int sig)
{
int save_errno;
- POOL_SETMASK(&BlockSig);
-
save_errno = errno;
+ POOL_SETMASK(&BlockSig);
+
#ifdef NOT_USED
ereport(LOG,
(errmsg("child process received shutdown request signal %d", sig)));
@@ -1124,8 +1124,9 @@ static RETSIGTYPE die(int sig)
break;
}
- errno = save_errno;
POOL_SETMASK(&UnBlockSig);
+
+ errno = save_errno;
}
/*
[parent: 2ec5d9f30abf]