[master] 3670ad6 Make sure complaints from (je)malloc aren't lost, at least on FreeBSD.

Poul-Henning Kamp phk at FreeBSD.org
Thu Oct 22 21:32:39 CEST 2015


commit 3670ad6dafb563c04400ebb42fc260c6f11cab17
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 22 19:31:28 2015 +0000

    Make sure complaints from (je)malloc aren't lost, at least on FreeBSD.

diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index e47f685..cc5471c 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -188,6 +188,16 @@ static struct cli_proto debug_cmds[] = {
  * XXX: Think more about which order we start things
  */
 
+#ifdef __FreeBSD__
+static void
+child_malloc_fail(void *p, const char *s)
+{
+	VSL(SLT_Error, 0, "MALLOC ERROR: %s (%p)", s, p);
+	fprintf(stderr, "MALLOC ERROR: %s (%p)\n", s, p);
+	WRONG("Malloc Error");
+}
+#endif
+
 void
 child_main(void)
 {
@@ -195,6 +205,9 @@ child_main(void)
 	setbuf(stdout, NULL);
 	setbuf(stderr, NULL);
 	printf("Child starts\n");
+#ifdef __FreeBSD__
+	malloc_message = child_malloc_fail;
+#endif
 
 	cache_param = heritage.param;
 



More information about the varnish-commit mailing list