dbus/test/test-segfault.c
Simon McVittie 64f94d3f5b Move _dbus_disable_crash_handling() back into test/ directory
It's only used in test code. We have to put it in its own translation
unit with no non-libc dependencies so that we can compile a copy of it
without AddressSanitizer support, because in a subsequent commit we will
special-case test-segfault to be compiled without using AddressSanitizer,
which would make linking to an AddressSanitizer-instrumented libdbus fail.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-11 12:47:22 +00:00

24 lines
342 B
C

/* This is simply a process that segfaults */
#include <config.h>
#include <stdlib.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include "disable-crash-handling.h"
int
main (int argc, char **argv)
{
char *p;
_dbus_disable_crash_handling ();
#ifdef HAVE_RAISE
raise (SIGSEGV);
#endif
p = NULL;
*p = 'a';
return 0;
}