check: use _exit() instead of exit() in fail_unless() so we exit immediately

exit() will call atexit handlers, which may try to
clean up things or wait for things to get cleaned up,
which we don't want or need. We just want to stop
and let the parent know about the failure as quickly
as possible in case fork() is used.

Fixes timeouts on assert failures in checks where
an exit handler waits for things to stop, but they
don't stop because they haven't been shut down,
and they haven't been shut down because there's no
simple way to do so on failures.

http://sourceforge.net/p/check/patches/50/
This commit is contained in:
Tim-Philipp Müller 2014-05-02 17:02:37 +01:00
parent 4e1699e030
commit a10ca2ee13

View file

@ -248,7 +248,7 @@ _fail_unless (int result, const char *file, int line, const char *expr, ...)
send_failure_info (buf); send_failure_info (buf);
if (cur_fork_status () == CK_FORK) { if (cur_fork_status () == CK_FORK) {
#ifdef _POSIX_VERSION #ifdef _POSIX_VERSION
exit (1); _exit (1);
#endif /* _POSIX_VERSION */ #endif /* _POSIX_VERSION */
} }
} }