[master] 41a1a42dd vbt: Do not assume libexecinfo availability

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jun 3 13:55:06 UTC 2024


commit 41a1a42dd9e4390d400fcc205bf1d3eac7970191
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Jun 3 15:52:49 2024 +0200

    vbt: Do not assume libexecinfo availability
    
    This is not the case for example on Alpine Linux.

diff --git a/lib/libvarnish/vbt.c b/lib/libvarnish/vbt.c
index 4a2da2c27..f68906e51 100644
--- a/lib/libvarnish/vbt.c
+++ b/lib/libvarnish/vbt.c
@@ -39,7 +39,9 @@
 #  include <libunwind.h>
 #endif
 
-#include <execinfo.h>
+#ifdef HAVE_EXECINFO_H
+#  include <execinfo.h>
+#endif
 
 #include "vdef.h"
 #include "vas.h"
@@ -91,7 +93,8 @@ vbt_unwind(struct vsb *vsb)
 }
 #endif
 
-#define BACKTRACE_LEVELS	20
+#ifdef HAVE_EXECINFO_H
+#  define BACKTRACE_LEVELS	20
 
 static void
 vbt_execinfo(struct vsb *vsb)
@@ -129,6 +132,7 @@ vbt_execinfo(struct vsb *vsb)
 		free(strings);
 	}
 }
+#endif
 
 void
 VBT_format(struct vsb *vsb)
@@ -137,7 +141,12 @@ VBT_format(struct vsb *vsb)
 #ifdef WITH_UNWIND
 	if (!vbt_unwind(vsb))
 		return;
+#  ifdef HAVE_EXECINFO_H
 	VSB_cat(vsb, "Falling back to execinfo backtrace\n");
+#  endif
 #endif
+
+#ifdef HAVE_EXECINFO_H
 	vbt_execinfo(vsb);
+#endif
 }


More information about the varnish-commit mailing list