os/ossrv/ofdbus/dbus/tsrc/testapps/dbus_test_cases/test-segfault.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/* Portion Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.*/
sl@0
     2
/* This is simply a process that segfaults */
sl@0
     3
#include <stdlib.h>
sl@0
     4
#ifndef TODO
sl@0
     5
#include <signal.h>
sl@0
     6
#endif
sl@0
     7
#include <sys/time.h>
sl@0
     8
#include <sys/resource.h>
sl@0
     9
sl@0
    10
int
sl@0
    11
main ()
sl@0
    12
{
sl@0
    13
  char *p;  
sl@0
    14
sl@0
    15
  struct rlimit r = { 0, };
sl@0
    16
  #ifndef TODO
sl@0
    17
  getrlimit (RLIMIT_CORE, &r);
sl@0
    18
  r.rlim_cur = 0;
sl@0
    19
  setrlimit (RLIMIT_CORE, &r);
sl@0
    20
  
sl@0
    21
   raise (SIGSEGV);
sl@0
    22
  #endif
sl@0
    23
  p = NULL;
sl@0
    24
  *p = 'a';
sl@0
    25
  
sl@0
    26
  return 0;
sl@0
    27
}