]> granicus.if.org Git - check/commitdiff
use atexit() instead of on_exit() for test
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 21 May 2014 03:28:07 +0000 (03:28 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 21 May 2014 03:28:07 +0000 (03:28 +0000)
atexit() is POSIX, whereas on_exit() is not.
Specifically, on_exit() does not exist on
OpenBSD (and perhaps other platforms)

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1134 64e312b2-a51f-0410-8e61-82d0ca0eb02a

tests/check_check_sub.c

index 67b5728ef11c340d65f430c6999a7ed466812223..c84a6556a4853020ecd22cf589d71465999e077f 100644 (file)
@@ -804,8 +804,8 @@ Suite *make_sub2_suite(void)
   return s;
 }
 
-void exit_handler(int, void*);
-void exit_handler (int ev, void *arg)
+void exit_handler();
+void exit_handler ()
 {
   // This exit handler should never be executed
   while(1)
@@ -816,7 +816,11 @@ void exit_handler (int ev, void *arg)
 
 START_TEST(test_ignore_exit_handlers)
 {
-  on_exit(exit_handler, NULL);
+  int result = atexit(exit_handler);
+  if(result != 0)
+  {
+    ck_abort_msg("Failed to set an exit handler, test cannot proceed");
+  }
   ck_abort();
 #define LINENO_ck_ignore_exit_handlers _STR(__LINE__)
 }