blob: 6e4516f00edd56704a1e86aa00cd8b09b0ba80b4 [file] [log] [blame]
#include <stdio.h>
#include <setjmp.h>
#include <signal.h>
jmp_buf buf;
void catchSigSegV( int sig )
{
longjmp(buf, 1);
}
int *ptr = 0;
int main(void)
{
volatile int v;
signal(SIGSEGV, catchSigSegV);
if (!setjmp(buf))
{
puts("Ready to catch");
v = *ptr;
puts("Bad");
}
else puts("Ok");
return 0;
}