]> granicus.if.org Git - check/commitdiff
* protect all calls to exit with _POSIX_VERSION, except in eprintf
authorcpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 1 Jan 2009 00:06:54 +0000 (00:06 +0000)
committercpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 1 Jan 2009 00:06:54 +0000 (00:06 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@515 64e312b2-a51f-0410-8e61-82d0ca0eb02a

src/check.c
src/check_run.c
tests/check_check_master.c
tests/check_check_sub.c

index a8798da201d876c1f0b87fc1340a5808ec62a61f..a00cd91da62903167ae83ad53e3d22ab75f5bcb8 100644 (file)
@@ -211,8 +211,11 @@ void _fail_unless (int result, const char *file,
     vsnprintf(buf, BUFSIZ, msg, ap);
     va_end(ap);
     send_failure_info (buf);
-    if (cur_fork_status() == CK_FORK)
+    if (cur_fork_status() == CK_FORK) {
+#ifdef _POSIX_VERSION
       exit(1);
+#endif /* _POSIX_VERSION */
+    }
   }
 }
 
index a5d4140daceacc77f7069aa3677ad12e857c5818..d39ae3e062bce93850481d43fe17ed374f37214c 100644 (file)
@@ -449,7 +449,9 @@ static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tfun, int i)
     tcase_run_checked_setup(sr, tc);
     tfun->fn(i);
     tcase_run_checked_teardown(tc);
+#ifdef _POSIX_VERSION
     exit(EXIT_SUCCESS);
+#endif /* _POSIX_VERSION */
   } else {
     group_pid = pid;
   }
@@ -558,10 +560,15 @@ void check_waitpid_and_exit (pid_t pid)
       pid_w = waitpid(pid, &status, 0);
 #endif /* _POSIX_VERSION */
     } while (pid_w == -1);
-    if (waserror(status, 0))
+    if (waserror(status, 0)) {
+#ifdef _POSIX_VERSION
       exit(EXIT_FAILURE);
+#endif /* _POSIX_VERSION */
+    }
   }
+#ifdef _POSIX_VERSION
   exit(EXIT_SUCCESS);
+#endif /* _POSIX_VERSION */
 }  
 
 static int waserror (int CK_ATTRIBUTE_UNUSED status, int signal_expected)
index fdcca70736258c650e536013788e26a71e832b22..aff50293dba2650e2ebf98428251b382fa5eaaee 100644 (file)
@@ -29,7 +29,7 @@ static char signal_8_str[SIG_STR_LEN];
 /* FIXME: all these line numbers are kind of hard to maintain */
 static master_test_t master_tests[] = {
   { "Simple Tests",  18, CK_FAILURE, "Failure expected" },
-  { "Simple Tests",  24, CK_ERROR,   "Early exit with return value 1" },
+  { "Simple Tests",  23, CK_ERROR,   "Early exit with return value 1" },
   { "Simple Tests",  -1, CK_PASS,    "Passed" },
   { "Simple Tests",  -1, CK_FAILURE, "This test should fail" },
   { "Simple Tests",  -1, CK_PASS,    "Passed" },
index 09f843e4503ee83033e6d89b9335aaf40e4d3535..474552bf6b71bcd96cd6bd454988fbd8cf036aff 100644 (file)
@@ -18,14 +18,14 @@ START_TEST(test_lno)
   fail("Failure expected"); /* line 18*/
 }
 END_TEST
-
 START_TEST(test_mark_lno)
 {
-  mark_point(); /* line 24*/
-  exit(EXIT_FAILURE); /* should fail at line 24*/
+  mark_point(); /* line 23*/
+#ifdef _POSIX_VERSION
+  exit(EXIT_FAILURE); /* should fail at line 23*/
+#endif /* _POSIX_VERSION */
 }
 END_TEST
-
 START_TEST(test_pass)
 {
   fail_unless(1 == 1, "This test should pass");