blob: 84947f372d9e44a74a4c51311c83b657584aed65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* $OpenBSD: setjmp-signal.c,v 1.2 2002/07/31 05:25:55 art Exp $ */
/*
* Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain.
*/
#include <setjmp.h>
#include <signal.h>
jmp_buf jb;
void
segv_handler(int signum)
{
longjmp(jb, 1);
}
int
main()
{
signal(SIGSEGV, segv_handler);
if (setjmp(jb) == 0) {
*((int *)addr) = 0;
return (1);
}
return (0);
}
|