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