[master] 0376b7f4b vtcp: make vtcp_sa_to_ascii error output more helpful

Nils Goroll nils.goroll at uplex.de
Sat Jan 9 20:17:14 UTC 2021


commit 0376b7f4b05954fac7902c75c9b6189094a48476
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat Jan 9 14:47:53 2021 +0100

    vtcp: make vtcp_sa_to_ascii error output more helpful
    
    - write to stderr
    - output errno for EAI_SYSTEM

diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 78a093738..84832cb65 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -73,7 +73,9 @@ vtcp_sa_to_ascii(const void *sa, socklen_t l, char *abuf, unsigned alen,
 		 * XXX this printf is shitty, but we may not have space
 		 * for the gai_strerror in the bufffer :-(
 		 */
-		printf("getnameinfo = %d %s\n", i, gai_strerror(i));
+		fprintf(stderr, "getnameinfo = %d %s\n", i, gai_strerror(i));
+		if (i == EAI_SYSTEM)
+			fprintf(stderr, "errno = %d %s\n", errno, vstrerror(errno));
 		if (abuf != NULL)
 			(void)snprintf(abuf, alen, "Conversion");
 		if (pbuf != NULL)


More information about the varnish-commit mailing list