>From c469f3741558427f3f82042ff4d1328e22e25795 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 7 Feb 2018 00:01:02 +0000 Subject: [PATCH 2/2] fix error checks in sigaltstack ss_size should not be checked if SS_DISABLE is set in ss->ss_flags and posix requires other flags to fail. the posix requirement may be too strict here, but musl should follow the spec until that's resolved: http://austingroupbugs.net/view.php?id=1187 --- src/signal/sigaltstack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/signal/sigaltstack.c b/src/signal/sigaltstack.c index 62cb81ad..017b53bc 100644 --- a/src/signal/sigaltstack.c +++ b/src/signal/sigaltstack.c @@ -4,13 +4,13 @@ int sigaltstack(const stack_t *restrict ss, stack_t *restrict old) { - if (ss) { - if (ss->ss_size < MINSIGSTKSZ) { - errno = ENOMEM; + if (ss && ss->ss_flags != SS_DISABLE) { + if (ss->ss_flags) { + errno = EINVAL; return -1; } - if (ss->ss_flags & ~SS_DISABLE) { - errno = EINVAL; + if (ss->ss_size < MINSIGSTKSZ) { + errno = ENOMEM; return -1; } } -- 2.15.0