mirror of
				https://gitlab.alpinelinux.org/alpine/aports.git
				synced 2025-10-31 00:12:05 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			898 B
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			898 B
		
	
	
	
		
			Diff
		
	
	
	
	
	
| Check if libc supports error backtracing from execinfo.h before attempting
 | |
| to use it (musl does not support this).
 | |
| --- a2jmidid-9/sigsegv.c
 | |
| +++ a2jmidid-9/sigsegv.c
 | |
| @@ -28,7 +28,9 @@
 | |
|  #include <signal.h>
 | |
|  #include <ucontext.h>
 | |
|  #include <dlfcn.h>
 | |
| +#ifdef LIBC_HAS_BACKTRACE
 | |
|  #include <execinfo.h>
 | |
| +#endif
 | |
|  #include <errno.h>
 | |
|  #ifndef NO_CPP_DEMANGLE
 | |
|  //#include <cxxabi.h>
 | |
| @@ -148,12 +150,14 @@
 | |
|          bp = (void**)bp[0];
 | |
|      }
 | |
|  #else
 | |
| -    a2j_error("Stack trace (non-dedicated):");
 | |
| -    sz = backtrace(bt, 20);
 | |
| -    strings = backtrace_symbols(bt, sz);
 | |
| +	#ifdef LIBC_HAS_BACKTRACE
 | |
| +		a2j_error("Stack trace (non-dedicated):");
 | |
| +		sz = backtrace(bt, 20);
 | |
| +		strings = backtrace_symbols(bt, sz);
 | |
|  
 | |
| -    for(i = 0; i < sz; ++i)
 | |
| -        a2j_error("%s", strings[i]);
 | |
| +		for(i = 0; i < sz; ++i)
 | |
| +			a2j_error("%s", strings[i]);
 | |
| +	#endif
 | |
|  #endif
 | |
|      a2j_error("End of stack trace");
 | |
|      exit (-1);
 |