>From 51a2203392d4199bf79d97f50db1b10a29a4f2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Wed, 4 Dec 2013 12:11:40 +0000 Subject: [PATCH] regex: suppress core dumps from detection code * m4/regex.m4 (gl_REGEX): Catch the SIGABRT and convert to SIGTERM to suppress core dumps that may well occur on glibc systems. These core dumps might not be cleaned up automatically, or could trigger some system core dump handling logic. --- ChangeLog | 8 ++++++++ m4/regex.m4 | 14 +++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50a16ef..3a7feac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-12-04 Pádraig Brady + + regex: suppress core dumps from detection code + * m4/regex.m4 (gl_REGEX): Catch the SIGABRT and convert to SIGTERM + to suppress core dumps that may well occur on glibc systems. + These core dumps might not be cleaned up automatically, or could + trigger some system core dump handling logic. + 2013-12-03 Pádraig Brady md5, sha1, sha256, sha512: support mandating use of openssl diff --git a/m4/regex.m4 b/m4/regex.m4 index 0089c08..795d720 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -38,13 +38,20 @@ AC_DEFUN([gl_REGEX], #include #include #include - #if HAVE_DECL_ALARM - # include + + #if defined M_CHECK_ACTION || HAVE_DECL_ALARM # include + # include #endif + #if HAVE_MALLOC_H # include #endif + + #ifdef M_CHECK_ACTION + /* Exit with distinguishable exit code. */ + static void sigabrt_no_core (int sig) { raise (SIGTERM); } + #endif ]], [[int result = 0; static struct re_pattern_buffer regex; @@ -61,7 +68,8 @@ AC_DEFUN([gl_REGEX], alarm (2); #endif #ifdef M_CHECK_ACTION - mallopt(M_CHECK_ACTION, 2); + signal (SIGABRT, sigabrt_no_core); + mallopt (M_CHECK_ACTION, 2); #endif if (setlocale (LC_ALL, "en_US.UTF-8")) -- 1.7.7.6