[master] c217f49 Turn cli write failuers into vtc_log(0) rather than asserts

Poul-Henning Kamp phk at FreeBSD.org
Thu Apr 16 12:35:49 CEST 2015


commit c217f497a17b976260775da1037e873775d4897f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Apr 16 10:35:32 2015 +0000

    Turn cli write failuers into vtc_log(0) rather than asserts

diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 490171e..7f87479 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -33,6 +33,7 @@
 #include <sys/socket.h>
 #include <sys/resource.h>
 
+#include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <poll.h>
@@ -96,9 +97,13 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
 	if (cmd != NULL) {
 		vtc_dump(v->vl, 4, "CLI TX", cmd, -1);
 		i = write(v->cli_fd, cmd, strlen(cmd));
-		assert(i == strlen(cmd));
+		if (i != strlen(cmd))
+			vtc_log(v->vl, 0, "CLI write failed (%s) = %u %s",
+			    cmd, errno, strerror(errno));
 		i = write(v->cli_fd, "\n", 1);
-		assert(i == 1);
+		if (i != 1)
+			vtc_log(v->vl, 0, "CLI write failed (%s) = %u %s",
+			    cmd, errno, strerror(errno));
 	}
 	i = VCLI_ReadResult(v->cli_fd, &retval, &r, 30.0);
 	if (i != 0) {



More information about the varnish-commit mailing list