From 7dfef2451da550abd2510eff87da78523278e476 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A5ns=20Rullg=C3=A5rd?= Date: Fri, 13 Apr 2007 20:16:13 +0000 Subject: [PATCH] trap signals in tests that can crash Originally committed as revision 8727 to svn://svn.ffmpeg.org/ffmpeg/trunk --- configure | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 2c6eeea..ae1841c 100755 --- a/configure +++ b/configure @@ -485,6 +485,32 @@ check_exec(){ check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; } } +check_exec_crash(){ + code=`cat` + + # exit() is not async signal safe. _Exit (C99) and _exit (POSIX) + # are safe but may not be available everywhere. Thus we use + # raise(SIGTERM) instead. The check is run in a subshell so we + # can redirect the "Terminated" message from the shell. SIGBUS + # is not defined by standard C so it is used conditionally. + + (check_exec "$@") >>$logfile 2>&1 < +static void sighandler(int sig){ + raise(SIGTERM); +} +int main(){ + signal(SIGILL, sighandler); + signal(SIGFPE, sighandler); + signal(SIGSEGV, sighandler); +#ifdef SIGBUS + signal(SIGBUS, sighandler); +#endif + { $code } +} +EOF +} + require(){ name="$1" header="$2" @@ -1191,10 +1217,6 @@ ar="${cross_prefix}${ar}" ranlib="${cross_prefix}${ranlib}" strip="${cross_prefix}${strip}" -# Disable core dumps so that intentional execution of broken apps doesn't -# pollute the current directory. -ulimit -c 0 >/dev/null 2>&1 - # we need to build at least one lib type if disabled_all static shared; then cat <>$logfile 2>&1 && enable ebp_available -int main(){ + check_exec_crash <