summaryrefslogtreecommitdiff
path: root/regress/usr.bin/lastcomm/crash.c
blob: 31e7df63d991e75ce8eb2382bbe04603c71b6357 (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: crash.c,v 1.1.1.1 2017/06/08 17:29:33 bluhm Exp $	*/

#include <err.h>
#include <stdlib.h>
#include <signal.h>

void handler(int);

int
main(int argc, char *argv[])
{
	int *i;

	if (signal(SIGSEGV, handler) == SIG_ERR)
		err(1, "signal");

	i = (void *)0x10UL;
	(*i)++;
	return *i;
}

void
handler(int signum)
{
	exit(0);
}