1 From 30f0cd91b21dbc5d593d61ae44875ad0cb53cb4d Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Sat, 16 Jul 2016 11:27:06 +0200
4 Subject: [PATCH] integck: only use execinfo.h when INTEGCK_DEBUG is enabled
6 Guard the usage of execinfo.h by INTEGCK_DEBUG so that by defaut,
7 integck builds properly on systems without <execinfo.h> (uClibc and
8 musl based systems). As stated in the code, the backtrace()
9 functionality of <execinfo.h> will anyway only work properly when
10 INTEGCK_DEBUG is defined (it makes all functions non-static, which is
11 needed for backtrace to provide some useful information).
13 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
15 tests/fs-tests/integrity/integck.c | 9 ++++++++-
16 1 file changed, 8 insertions(+), 1 deletion(-)
18 diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
19 index 8badd1f..6ef817e 100644
20 --- a/tests/fs-tests/integrity/integck.c
21 +++ b/tests/fs-tests/integrity/integck.c
29 #include <bits/stdio_lim.h>
32 @@ -248,14 +250,18 @@ static char *random_name_buf;
33 static void check_failed(const char *cond, const char *func, const char *file,
36 - int error = errno, count;
45 errmsg("condition '%s' failed in %s() at %s:%d",
46 cond, func, file, line);
47 normsg("error %d (%s)", error, strerror(error));
50 * Note, to make this work well you need:
51 * 1. Make all functions non-static - add "#define static'
52 @@ -264,6 +270,7 @@ static void check_failed(const char *cond, const char *func, const char *file,
54 count = backtrace(addresses, 128);
55 backtrace_symbols_fd(addresses, count, fileno(stdout));