mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 13:27:09 +02:00
39 lines
874 B
Diff
39 lines
874 B
Diff
diff --git a/src/sighand.c b/src/sighand.c
|
|
index 5b6ba2a..04a1ade 100644
|
|
--- a/src/sighand.c
|
|
+++ b/src/sighand.c
|
|
@@ -30,7 +30,9 @@
|
|
#include <errno.h> /* for errno() */
|
|
#include <sys/wait.h> /* for wait() */
|
|
#include <sys/socket.h> /* for shutdown() */
|
|
+#ifdef HAVE_EXECINFO_H
|
|
#include <execinfo.h>
|
|
+#endif
|
|
|
|
#include "log.h"
|
|
#include "sighand.h"
|
|
@@ -113,6 +115,7 @@ sighand_chld (pid_t pid)
|
|
waitpid (pid, &status, WNOHANG);
|
|
}
|
|
|
|
+#ifdef HAVE_EXECINFO_H
|
|
static void
|
|
print_trace ()
|
|
{
|
|
@@ -140,12 +143,15 @@ print_trace ()
|
|
ret = backtrace (array, 10);
|
|
backtrace_symbols_fd (array, ret, fd);
|
|
}
|
|
+#endif
|
|
|
|
void
|
|
sighand_segv (int given_signal)
|
|
{
|
|
signal (SIGSEGV, _exit);
|
|
+#ifdef HAVE_EXECINFO_H
|
|
print_trace ();
|
|
+#endif
|
|
make_em_die (SIGTERM);
|
|
/* Raise signal again, to exit with the correct return value,
|
|
* and to enable core dumping. */
|