From: brarcher Date: Fri, 27 Sep 2013 01:38:33 +0000 (+0000) Subject: Only use signals if fork is available X-Git-Tag: 0.10.0~415 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab2d0dc9f629f7c3edf233772f8a02d26f40cf64;p=check Only use signals if fork is available The code at the top of this file for signals and fork is protected by HAVE_FORK. The signals usage is not very useful without fork, so now protecting the signal code with HAVE_FORK as well. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@799 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/src/check_run.c b/src/check_run.c index ac7120f..51ca53e 100644 --- a/src/check_run.c +++ b/src/check_run.c @@ -600,10 +600,10 @@ void srunner_run_all (SRunner *sr, enum print_output print_mode) void srunner_run (SRunner *sr, const char *sname, const char *tcname, enum print_output print_mode) { -#ifdef HAVE_SIGACTION +#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) struct sigaction old_action; struct sigaction new_action; -#endif /* HAVE_SIGACTION */ +#endif /* HAVE_SIGACTION && HAVE_FORK */ /* Get the selected test suite and test case from the environment. */ @@ -617,17 +617,17 @@ void srunner_run (SRunner *sr, const char *sname, const char *tcname, enum print eprintf ("Bad print_mode argument to srunner_run_all: %d", __FILE__, __LINE__, print_mode); } -#ifdef HAVE_SIGACTION +#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) memset(&new_action, 0, sizeof new_action); new_action.sa_handler = sig_handler; sigaction(SIGALRM, &new_action, &old_action); -#endif /* HAVE_SIGACTION */ +#endif /* HAVE_SIGACTION && HAVE_FORK*/ srunner_run_init (sr, print_mode); srunner_iterate_suites (sr, sname, tcname, print_mode); srunner_run_end (sr, print_mode); -#ifdef HAVE_SIGACTION +#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) sigaction(SIGALRM, &old_action, NULL); -#endif /* HAVE_SIGACTION */ +#endif /* HAVE_SIGACTION && HAVE_FORK */ } pid_t check_fork (void)