Skip to content

Commit 5ac9e86

Browse files
committed
Mark sigint_interrupt_enabled as sig_atomic_t
This is a continuation of 78fdb1e, where this flag is set in the psql callback handler used for SIGINT. This was previously a boolean but the C standard recommends the use of sig_atomic_t. Note that this influences PromptInterruptContext in string.h, where the same flag is tracked. Author: Hayato Kuroda Discussion: https://postgr.es/m/TYAPR01MB58669A9EC96AA3078C2CD938F5549@TYAPR01MB5866.jpnprd01.prod.outlook.com
1 parent b8d8a45 commit 5ac9e86

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/bin/psql/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ NoticeProcessor(void *arg, const char *message)
246246
* On Windows, currently this does not work, so control-C is less useful
247247
* there.
248248
*/
249-
volatile bool sigint_interrupt_enabled = false;
249+
volatile sig_atomic_t sigint_interrupt_enabled = false;
250250

251251
sigjmp_buf sigint_interrupt_jmp;
252252

src/bin/psql/common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define COMMON_H
1010

1111
#include <setjmp.h>
12+
#include <signal.h>
1213

1314
#include "fe_utils/print.h"
1415
#include "fe_utils/psqlscan.h"
@@ -22,7 +23,7 @@ extern char *psql_get_variable(const char *varname, PsqlScanQuoteType quote,
2223

2324
extern void NoticeProcessor(void *arg, const char *message);
2425

25-
extern volatile bool sigint_interrupt_enabled;
26+
extern volatile sig_atomic_t sigint_interrupt_enabled;
2627

2728
extern sigjmp_buf sigint_interrupt_jmp;
2829

src/include/common/string.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#ifndef COMMON_STRING_H
1111
#define COMMON_STRING_H
1212

13+
#include <signal.h>
14+
1315
struct StringInfoData; /* avoid including stringinfo.h here */
1416

1517
typedef struct PromptInterruptContext
1618
{
1719
/* To avoid including <setjmp.h> here, jmpbuf is declared "void *" */
1820
void *jmpbuf; /* existing longjmp buffer */
19-
volatile bool *enabled; /* flag that enables longjmp-on-interrupt */
21+
volatile sig_atomic_t *enabled; /* flag that enables longjmp-on-interrupt */
2022
bool canceled; /* indicates whether cancellation occurred */
2123
} PromptInterruptContext;
2224

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy