mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-27 03:14:04 -04:00
Merge branch 'wip/smcv/disable-crash-reporting' into 'master'
testutils: Add a backport of g_test_disable_crash_reporting() See merge request GNOME/libglnx!50
This commit is contained in:
@@ -33,6 +33,9 @@
|
||||
#include "glnx-backport-testutils.h"
|
||||
#include "glnx-backports.h"
|
||||
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 68, 0)
|
||||
/* Backport of g_assertion_message_cmpstrv() */
|
||||
void
|
||||
@@ -143,3 +146,17 @@ _glnx_test_incomplete_printf (const char *format,
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 78, 0)
|
||||
void
|
||||
_glnx_test_disable_crash_reporting (void)
|
||||
{
|
||||
struct rlimit limit = { 0, 0 };
|
||||
|
||||
(void) setrlimit (RLIMIT_CORE, &limit);
|
||||
|
||||
/* On Linux, RLIMIT_CORE = 0 is ignored if core dumps are
|
||||
* configured to be written to a pipe, but PR_SET_DUMPABLE is not. */
|
||||
(void) prctl (PR_SET_DUMPABLE, 0, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -201,4 +201,9 @@ void _glnx_test_skip_printf (const char *format, ...) G_GNUC_PRINTF (1, 2);
|
||||
void _glnx_test_incomplete_printf (const char *format, ...) G_GNUC_PRINTF (1, 2);
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 78, 0)
|
||||
#define g_test_disable_crash_reporting _glnx_test_disable_crash_reporting
|
||||
void _glnx_test_disable_crash_reporting (void);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -243,6 +243,7 @@ main (int argc,
|
||||
}
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
g_test_disable_crash_reporting ();
|
||||
#if GLIB_CHECK_VERSION(2, 38, 0)
|
||||
g_test_set_nonfatal_assertions ();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user