mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-20 04:30:10 +01:00
Only do the deliberate crash via undefined behaviour (which the compiler is quite right to warn us about!) if raise() isn't available. The pointer needs to be volatile otherwise the compiler is free to remove the store. Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275 Reviewed-by: Simon McVittie <smcv@collabora.com>
25 lines
359 B
C
25 lines
359 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)
|
|
{
|
|
_dbus_disable_crash_handling ();
|
|
|
|
#ifdef HAVE_RAISE
|
|
raise (SIGSEGV);
|
|
#else
|
|
{
|
|
volatile char *p = NULL;
|
|
*p = 'a';
|
|
}
|
|
#endif
|
|
|
|
return 0;
|
|
}
|