xref: /OK3568_Linux_fs/buildroot/package/ofono/0001-uclibc-backtrace.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1[PATCH] fix build on uClibc without UCLIBC_HAS_BACKTRACE
2
3Backtrace support is only used for logging on signal errors, which
4isn't really critical, so simply remove backtrace info if not
5available in uClibc.
6
7NOTE: based on patch from Peter Korsgaard <jacmet@sunsite.dk>
8
9Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
10---
11--- ofono-1.7.orig/src/log.c
12+++ ofono-1.7/src/log.c
13@@ -30,7 +30,8 @@
14 #include <stdlib.h>
15 #include <string.h>
16 #include <syslog.h>
17-#ifdef __GLIBC__
18+#if defined(__GLIBC__) && !(defined(__UCLIBC__) && !defined (__UCLIBC_HAS_BACKTRACE__))
19+#define HAVE_BACKTRACE
20 #include <execinfo.h>
21 #endif
22 #include <dlfcn.h>
23@@ -115,7 +116,7 @@
24	va_end(ap);
25 }
26
27-#ifdef __GLIBC__
28+#ifdef HAVE_BACKTRACE
29 static void print_backtrace(unsigned int offset)
30 {
31 	void *frames[99];
32@@ -312,7 +313,7 @@
33	if (detach == FALSE)
34		option |= LOG_PERROR;
35
36-#ifdef __GLIBC__
37+#ifdef HAVE_BACKTRACE
38	signal_setup(signal_handler);
39 #endif
40
41@@ -329,7 +330,7 @@
42
43	closelog();
44
45-#ifdef __GLIBC__
46+#ifdef HAVE_BACKTRACE
47	signal_setup(SIG_DFL);
48 #endif
49
50