[master] b9459df18 Report errno on asserts

Poul-Henning Kamp phk at FreeBSD.org
Tue Oct 16 10:18:10 UTC 2018


commit b9459df18281b30c3b0fd60135a44bb4c5e83d6c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Oct 16 09:13:45 2018 +0000

    Report errno on asserts

diff --git a/bin/varnishtest/vtc_log.c b/bin/varnishtest/vtc_log.c
index 94bee3d3f..1e6e321e8 100644
--- a/bin/varnishtest/vtc_log.c
+++ b/bin/varnishtest/vtc_log.c
@@ -28,6 +28,7 @@
 
 #include "config.h"
 
+#include <errno.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -273,17 +274,19 @@ vtc_log_VAS_Fail(const char *func, const char *file, int line,
     const char *cond, enum vas_e why)
 {
 	struct vtclog *vl;
+	int e = errno;
 
 	(void)why;
 	vl = pthread_getspecific(log_key);
 	if (vl == NULL || vl->act) {
 		fprintf(stderr,
 		    "Assert error in %s(), %s line %d:\n"
-		    "  Condition(%s) not true.\n",
-		    func, file, line, cond);
+		    "  Condition(%s) not true. (errno=%d %s)\n",
+		    func, file, line, cond, e, strerror(e));
 	} else
 		vtc_fatal(vl, "Assert error in %s(), %s line %d:"
-		    "  Condition(%s) not true.\n", func, file, line, cond);
+		    "  Condition(%s) not true."
+		    "  Errno=%d %s", func, file, line, cond, e, strerror(e));
 	abort();
 }
 


More information about the varnish-commit mailing list