musl/src/signal/siglongjmp.c
Rich Felker 9ae8d5fc71 fix all implicit conversion between signed/unsigned pointers
sadly the C language does not specify any such implicit conversion, so
this is not a matter of just fixing warnings (as gcc treats it) but
actual errors. i would like to revisit a number of these changes and
possibly revise the types used to reduce the number of casts required.
2011-03-25 16:34:03 -04:00

13 lines
284 B
C

#include <setjmp.h>
#include <signal.h>
#include <stdlib.h>
void siglongjmp(sigjmp_buf buf, int ret)
{
unsigned long *flag = buf + sizeof(jmp_buf)/sizeof(long);
sigset_t *mask = (void *)(flag + 1);
if (*flag)
sigprocmask (SIG_SETMASK, mask, NULL);
longjmp((void *)buf, ret);
}