python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / mtd / 0002-integck-only-use-execinfo.h-when-INTEGCK_DEBUG-is-en.patch
blob0f74a7b5b1a2c9fac11c60cc73b4eaf05189332b
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>
14 ---
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
22 @@ -31,7 +31,9 @@
23 #include <getopt.h>
24 #include <assert.h>
25 #include <mntent.h>
26 +#ifdef INTEGCK_DEBUG
27 #include <execinfo.h>
28 +#endif
29 #include <bits/stdio_lim.h>
30 #include <sys/mman.h>
31 #include <sys/vfs.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,
34 int line)
36 - int error = errno, count;
37 + int error = errno;
38 +#ifdef INTEGCK_DEBUG
39 + int count;
40 void *addresses[128];
41 +#endif
43 fflush(stdout);
44 fflush(stderr);
45 errmsg("condition '%s' failed in %s() at %s:%d",
46 cond, func, file, line);
47 normsg("error %d (%s)", error, strerror(error));
48 +#ifdef INTEGCK_DEBUG
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));
56 +#endif
57 exit(EXIT_FAILURE);
60 --
61 2.7.4