From 4dbca0ae3eafb9e21f2cdb2305395e7976feacb4 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 22 Apr 2013 10:22:00 -0400 Subject: improve sigsetjmp test previously failure to save the signal mask was not being caught due to the uninitialized buffer containing zero bits (by chance). --- setjmp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setjmp.c b/setjmp.c index 6728bef..b740be5 100644 --- a/setjmp.c +++ b/setjmp.c @@ -40,6 +40,10 @@ int test_setjmp(void) sigprocmask(SIG_UNBLOCK, &set, &set); oldset = set; + /* Improve the chances of catching failure of sigsetjmp to + * properly save the signal mask in the sigjmb_buf. */ + memset(&sjb, -1, sizeof sjb); + if (!sigsetjmp(sjb, 1)) { sigemptyset(&set); sigaddset(&set, SIGUSR1); -- cgit v1.2.1