mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-21 15:30:10 +01:00
On Linux, call prctl to disable core dumps
Whenever I forget to turn off corekeeper, the regression tests take ages to record all test-segfault's crashes. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83772 Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
This commit is contained in:
parent
467f7a6d42
commit
ae50d46ff2
2 changed files with 21 additions and 1 deletions
|
|
@ -598,6 +598,10 @@ if test "x$ac_cv_header_syslog_h" = "xyes"; then
|
||||||
AC_CHECK_DECLS([LOG_PERROR], [], [], [[#include <syslog.h>]])
|
AC_CHECK_DECLS([LOG_PERROR], [], [], [[#include <syslog.h>]])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# For test-segfault.c
|
||||||
|
AC_CHECK_HEADERS_ONCE([sys/prctl.h])
|
||||||
|
AC_CHECK_FUNCS_ONCE([prctl raise])
|
||||||
|
|
||||||
#### Check for broken poll; taken from Glib's configure
|
#### Check for broken poll; taken from Glib's configure
|
||||||
|
|
||||||
AC_MSG_CHECKING([for broken poll])
|
AC_MSG_CHECKING([for broken poll])
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,34 @@
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_PRCTL_H
|
||||||
|
#include <sys/prctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
#if HAVE_SETRLIMIT
|
#if HAVE_SETRLIMIT
|
||||||
|
/* No core dumps please, we know we crashed. */
|
||||||
struct rlimit r = { 0, };
|
struct rlimit r = { 0, };
|
||||||
|
|
||||||
getrlimit (RLIMIT_CORE, &r);
|
getrlimit (RLIMIT_CORE, &r);
|
||||||
r.rlim_cur = 0;
|
r.rlim_cur = 0;
|
||||||
setrlimit (RLIMIT_CORE, &r);
|
setrlimit (RLIMIT_CORE, &r);
|
||||||
|
#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
|
||||||
raise (SIGSEGV);
|
raise (SIGSEGV);
|
||||||
#endif
|
#endif
|
||||||
p = NULL;
|
p = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue