Mercurial > hg > octave-nkf > gnulib-hg
diff lib/c-stack.c @ 10470:9867f4fee019
c-stack: work around Irix sigaltstack bug
* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Check
whether sigaltstack uses wrong end of stack_t (copied in part from
libsigsegv).
* lib/c-stack.c (c_stack_action) [!HAVE_LIBSIGSEGV]: Work around
Irix bug, without requiring an over-allocation.
* doc/posix-functions/sigaltstack.texi (sigaltstack): Document the
bug.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 23 Sep 2008 08:47:26 -0600 (2008-09-23) |
parents | 37fd490ee38d |
children | d31da80e6c50 |
line wrap: on
line diff
--- a/lib/c-stack.c +++ b/lib/c-stack.c @@ -291,8 +291,15 @@ stack_t st; struct sigaction act; st.ss_flags = 0; +# if SIGALTSTACK_SS_REVERSED + /* Irix mistakenly treats ss_sp as the upper bound, rather than + lower bound, of the alternate stack. */ + st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *); + st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *); +# else st.ss_sp = alternate_signal_stack.buffer; st.ss_size = sizeof alternate_signal_stack.buffer; +# endif r = sigaltstack (&st, NULL); if (r != 0) return r;