diff options
author | Tim Kientzle <kientzle@gmail.com> | 2016-03-22 20:28:42 -0700 |
---|---|---|
committer | Tim Kientzle <kientzle@gmail.com> | 2016-03-22 20:28:42 -0700 |
commit | e84294e425b4818ee398b137a840f2b086ddfa97 (patch) | |
tree | d165bae23ae6d50fac24fdc7f107b3274297918d /libarchive_fe/passphrase.c | |
parent | c4f5568d8365b8920c9b9a8fbebf7b21c5262f49 (diff) | |
download | libarchive-e84294e425b4818ee398b137a840f2b086ddfa97.tar.gz |
Issue 675: SIGRTMAX can be non-constant, so allocate the signal tracking array at runtime
Diffstat (limited to 'libarchive_fe/passphrase.c')
-rw-r--r-- | libarchive_fe/passphrase.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; |