[6.0] d9139f2cd Report errno on asserts
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:32 UTC 2018
commit d9139f2cddef8e68383ba995f4f71972cd65b3f4
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