Error message will be reported as e.g. "Connection refused" instead of
simply "(null)".

OK?
From 29aeada73dbf4f1c1fc3d14e7f6aed6d169f8951 Mon Sep 17 00:00:00 2001
From: "Federico G. Schwindt" <[email protected]>
Date: Sat, 12 Sep 2015 20:57:43 +0100
Subject: [PATCH] Set error if callback returned < 0

---
 lib/libvarnish/vss.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/libvarnish/vss.c b/lib/libvarnish/vss.c
index 6d1b809..61107ef 100644
--- a/lib/libvarnish/vss.c
+++ b/lib/libvarnish/vss.c
@@ -35,6 +35,7 @@
 
 #include <netinet/in.h>
 
+#include <errno.h>
 #include <netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -140,6 +141,8 @@ VSS_resolver(const char *addr, const char *def_port, vss_resolved_f *func,
 				break;
 		}
 	}
+	if (ret < 0)
+		*err = strerror(errno);
 	freeaddrinfo(res0);
 	return (ret);
 }
-- 
2.5.1

_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to