From: Tim Kientzle Date: Wed, 23 Mar 2016 03:28:42 +0000 (-0700) Subject: Issue 675: SIGRTMAX can be non-constant, so allocate the signal tracking array at... X-Git-Tag: v3.1.901a~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e84294e425b4818ee398b137a840f2b086ddfa97;p=thirdparty%2Flibarchive.git Issue 675: SIGRTMAX can be non-constant, so allocate the signal tracking array at runtime --- diff --git a/libarchive_fe/passphrase.c b/libarchive_fe/passphrase.c index c9eaba641..1eae0b888 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;