test-segfault.c revision 892780c35e6edc4103858c2df55547c4f07d5c4f
1/* This is simply a process that segfaults */
2#include <config.h>
3#include <stdlib.h>
4#include <signal.h>
5
6#ifdef HAVE_SETRLIMIT
7#include <sys/resource.h>
8#endif
9
10int
11main (int argc, char **argv)
12{
13  char *p;
14
15#if HAVE_SETRLIMIT
16  struct rlimit r = { 0, };
17
18  getrlimit (RLIMIT_CORE, &r);
19  r.rlim_cur = 0;
20  setrlimit (RLIMIT_CORE, &r);
21
22  raise (SIGSEGV);
23#endif
24  p = NULL;
25  *p = 'a';
26
27  return 0;
28}
29