From e84294e425b4818ee398b137a840f2b086ddfa97 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Tue, 22 Mar 2016 20:28:42 -0700 Subject: Issue 675: SIGRTMAX can be non-constant, so allocate the signal tracking array at runtime --- libarchive_fe/passphrase.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libarchive_fe') diff --git a/libarchive_fe/passphrase.c b/libarchive_fe/passphrase.c index c9eaba64..1eae0b88 100644 --- a/libarchive_fe/passphrase.c +++ b/libarchive_fe/passphrase.c @@ -142,12 +142,11 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) # define _POSIX_VDISABLE VDISABLE #endif -static volatile sig_atomic_t signo[SIGRTMAX]; +static volatile sig_atomic_t *signo; static void handler(int s) { - signo[s] = 1; } @@ -167,6 +166,10 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) return(NULL); } + if (signo == NULL) { + signo = calloc(SIGRTMAX, sizeof(sig_atomic_t)); + } + restart: for (i = 0; i < SIGRTMAX; i++) signo[i] = 0; -- cgit v1.2.1