2003-04-05 00:37:17 +00:00
|
|
|
/* This is simply a process that segfaults */
|
2007-03-07 18:34:01 +00:00
|
|
|
#include <config.h>
|
* dbus/dbus-auth.c, dbus/dbus-connection.c, dbus/dbus-keyring.c,
dbus/dbus-server-debug-pipe.c, glib/dbus-binding-tool-glib.c
glib/dbus-glib-tool.c, glib/dbus-gparser.c, glib/dbus-gproxy.c
test/test-segfault.c, test/test-utils.c,
test/glib/test-dbus-glib.c, tools/dbus-cleanup-sockets.c
tools/dbus-launch.c, tools/dbus-tree-view.c, tools/dbus-viewer.c:
Various cleanup of dead code and compiler warnings (patch from
Kjartan Maraas <kmaraas at gnome.org>)
2005-11-30 19:32:27 +00:00
|
|
|
#include <stdlib.h>
|
2010-03-16 03:33:04 +01:00
|
|
|
#ifdef HAVE_SIGNAL_H
|
2003-04-05 00:37:17 +00:00
|
|
|
#include <signal.h>
|
2010-03-16 03:33:04 +01:00
|
|
|
#endif
|
2003-04-05 00:37:17 +00:00
|
|
|
|
2007-03-08 08:17:25 +00:00
|
|
|
#ifdef HAVE_SETRLIMIT
|
2007-03-07 19:09:57 +00:00
|
|
|
#include <sys/resource.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-09-15 11:50:48 +01:00
|
|
|
#ifdef HAVE_SYS_PRCTL_H
|
|
|
|
|
#include <sys/prctl.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-05-09 17:31:17 +02:00
|
|
|
#ifdef DBUS_WIN
|
2016-05-16 14:10:36 +01:00
|
|
|
#include <stdio.h>
|
2016-05-09 17:31:17 +02:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
2016-10-10 16:13:58 +01:00
|
|
|
#include <dbus/dbus-macros.h>
|
|
|
|
|
|
|
|
|
|
int exception_handler (LPEXCEPTION_POINTERS p) _DBUS_GNUC_NORETURN;
|
2016-05-09 17:31:17 +02:00
|
|
|
|
|
|
|
|
/* Explicit Windows exception handlers needed to supress OS popups */
|
|
|
|
|
int
|
|
|
|
|
exception_handler(LPEXCEPTION_POINTERS p)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "test-segfault: raised fatal exception as intended\n");
|
|
|
|
|
ExitProcess(0xc0000005);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-04-05 00:37:17 +00:00
|
|
|
int
|
|
|
|
|
main (int argc, char **argv)
|
|
|
|
|
{
|
2003-04-11 03:45:40 +00:00
|
|
|
char *p;
|
|
|
|
|
|
2016-05-09 17:31:17 +02:00
|
|
|
#ifdef DBUS_WIN
|
|
|
|
|
/* Disable Windows popup dialog when an app crashes so that app quits
|
|
|
|
|
* immediately with error code instead of waiting for user to dismiss
|
|
|
|
|
* the dialog. */
|
|
|
|
|
DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
|
|
|
|
|
SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX);
|
|
|
|
|
/* Disable "just in time" debugger */
|
|
|
|
|
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)&exception_handler);
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-10-10 15:07:34 +01:00
|
|
|
#ifdef HAVE_SETRLIMIT
|
2014-09-15 11:50:48 +01:00
|
|
|
/* No core dumps please, we know we crashed. */
|
2003-04-11 03:45:40 +00:00
|
|
|
struct rlimit r = { 0, };
|
|
|
|
|
|
|
|
|
|
getrlimit (RLIMIT_CORE, &r);
|
|
|
|
|
r.rlim_cur = 0;
|
|
|
|
|
setrlimit (RLIMIT_CORE, &r);
|
2014-09-15 11:50:48 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
|
|
|
|
|
/* Really, no core dumps please. On Linux, if core_pattern is
|
|
|
|
|
* set to a pipe (for abrt/apport/corekeeper/etc.), RLIMIT_CORE of 0
|
|
|
|
|
* is ignored (deliberately, so people can debug init(8) and other
|
|
|
|
|
* early stuff); but Linux has PR_SET_DUMPABLE, so we can avoid core
|
|
|
|
|
* dumps anyway. */
|
|
|
|
|
prctl (PR_SET_DUMPABLE, 0, 0, 0, 0);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RAISE
|
2003-04-05 00:37:17 +00:00
|
|
|
raise (SIGSEGV);
|
2007-03-07 18:34:01 +00:00
|
|
|
#endif
|
* dbus/dbus-auth.c, dbus/dbus-connection.c, dbus/dbus-keyring.c,
dbus/dbus-server-debug-pipe.c, glib/dbus-binding-tool-glib.c
glib/dbus-glib-tool.c, glib/dbus-gparser.c, glib/dbus-gproxy.c
test/test-segfault.c, test/test-utils.c,
test/glib/test-dbus-glib.c, tools/dbus-cleanup-sockets.c
tools/dbus-launch.c, tools/dbus-tree-view.c, tools/dbus-viewer.c:
Various cleanup of dead code and compiler warnings (patch from
Kjartan Maraas <kmaraas at gnome.org>)
2005-11-30 19:32:27 +00:00
|
|
|
p = NULL;
|
2003-04-05 00:37:17 +00:00
|
|
|
*p = 'a';
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|