From 4fe60b47b97626ca207525ef557ec3f8f124a001 Mon Sep 17 00:00:00 2001
From: "kuroda.hayato%40jp.fujitsu.com" <kuroda.hayato@jp.fujitsu.com>
Date: Wed, 28 Sep 2022 04:33:27 +0000
Subject: [PATCH] Mark sigint_interrupt_enabled as sig_atomic_t

---
 src/bin/psql/common.c       | 2 +-
 src/bin/psql/common.h       | 3 ++-
 src/include/common/string.h | 4 +++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index e611e3266d..4f42676066 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -246,7 +246,7 @@ NoticeProcessor(void *arg, const char *message)
  * On Windows, currently this does not work, so control-C is less useful
  * there.
  */
-volatile bool sigint_interrupt_enabled = false;
+volatile sig_atomic_t sigint_interrupt_enabled = false;
 
 sigjmp_buf	sigint_interrupt_jmp;
 
diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h
index d84c3a007c..f0820dd7d5 100644
--- a/src/bin/psql/common.h
+++ b/src/bin/psql/common.h
@@ -9,6 +9,7 @@
 #define COMMON_H
 
 #include <setjmp.h>
+#include <signal.h>
 
 #include "fe_utils/print.h"
 #include "fe_utils/psqlscan.h"
@@ -22,7 +23,7 @@ extern char *psql_get_variable(const char *varname, PsqlScanQuoteType quote,
 
 extern void NoticeProcessor(void *arg, const char *message);
 
-extern volatile bool sigint_interrupt_enabled;
+extern volatile sig_atomic_t sigint_interrupt_enabled;
 
 extern sigjmp_buf sigint_interrupt_jmp;
 
diff --git a/src/include/common/string.h b/src/include/common/string.h
index 3d59172151..598b4d0fd6 100644
--- a/src/include/common/string.h
+++ b/src/include/common/string.h
@@ -10,13 +10,15 @@
 #ifndef COMMON_STRING_H
 #define COMMON_STRING_H
 
+#include <signal.h>
+
 struct StringInfoData;			/* avoid including stringinfo.h here */
 
 typedef struct PromptInterruptContext
 {
 	/* To avoid including <setjmp.h> here, jmpbuf is declared "void *" */
 	void	   *jmpbuf;			/* existing longjmp buffer */
-	volatile bool *enabled;		/* flag that enables longjmp-on-interrupt */
+	volatile sig_atomic_t *enabled;		/* flag that enables longjmp-on-interrupt */
 	bool		canceled;		/* indicates whether cancellation occurred */
 } PromptInterruptContext;
 
-- 
2.27.0

