summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-09-14 18:24:41 +0200
committerAndreas Schneider <asn@cryptomilk.org>2015-09-14 18:24:41 +0200
commitcc3386b4ce502e532686a6ec0c56af362cb33e86 (patch)
tree332365bdf134530b3cd9d721cd46c0f6d7f0744e
parent2535a154fe4210999f813e0f5d8778f833ea8165 (diff)
downloadcmocka-cc3386b4ce502e532686a6ec0c56af362cb33e86.tar.gz
cmocka-cc3386b4ce502e532686a6ec0c56af362cb33e86.tar.bz2
cmocka-cc3386b4ce502e532686a6ec0c56af362cb33e86.zip
src: Simplify exception_handler()
-rw-r--r--src/cmocka.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cmocka.c b/src/cmocka.c
index fda3682..333a739 100644
--- a/src/cmocka.c
+++ b/src/cmocka.c
@@ -1797,11 +1797,14 @@ void _fail(const char * const file, const int line) {
#ifndef _WIN32
static void exception_handler(int sig) {
+ const char *sig_strerror = "";
+
#ifdef HAVE_STRSIGNAL
- cm_print_error("Test failed with exception: %s\n", strsignal(sig));
-#else
- cm_print_error("Test failed with exception: %d\n", sig);
+ sig_strerror = strsignal(sig);
#endif
+
+ cm_print_error("Test failed with exception: %s(%d)",
+ sig_strerror, sig);
exit_test(1);
}