]> granicus.if.org Git - check/commitdiff
Only use signals if fork is available
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 27 Sep 2013 01:38:33 +0000 (01:38 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 27 Sep 2013 01:38:33 +0000 (01:38 +0000)
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

src/check_run.c

index ac7120ffe3dfe2bf80122f37f695fd9e2d2c87f1..51ca53e597ed24a4fa16a7bd3ff33a6c772fa0d1 100644 (file)
@@ -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)