From: brarcher Date: Wed, 21 May 2014 03:28:07 +0000 (+0000) Subject: use atexit() instead of on_exit() for test X-Git-Tag: 0.10.0~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d9d6f162b8e0bce814c40f3002e23db40d45a35;p=check use atexit() instead of on_exit() for test 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 --- diff --git a/tests/check_check_sub.c b/tests/check_check_sub.c index 67b5728..c84a655 100644 --- a/tests/check_check_sub.c +++ b/tests/check_check_sub.c @@ -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__) }