summaryrefslogtreecommitdiffstats
path: root/test/test-segfault.c
blob: dd1c87fe697a61aa268769234922acaf44c59de8 (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
27
28
29
/* This is simply a process that segfaults */
#include <config.h>
#include <stdlib.h>
#include <signal.h>

#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
#include <sys/time.h>
#include <sys/resource.h>
#endif

int
main (int argc, char **argv)
{
  char *p;  

#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
  struct rlimit r = { 0, };
  
  getrlimit (RLIMIT_CORE, &r);
  r.rlim_cur = 0;
  setrlimit (RLIMIT_CORE, &r);
  
  raise (SIGSEGV);
#endif
  p = NULL;
  *p = 'a';
  
  return 0;
}