r4517 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Feb 1 11:36:52 CET 2010


Author: phk
Date: 2010-02-01 11:36:52 +0100 (Mon, 01 Feb 2010)
New Revision: 4517

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_cli.c
Log:
Don't assert on write errors to the child process CLI-pipe, it might
simply be dying on us.  Instead return the designed error code for
this: CLIS_COMM 

Fixes	#639



Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c	2010-02-01 09:00:13 UTC (rev 4516)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c	2010-02-01 10:36:52 UTC (rev 4517)
@@ -175,9 +175,19 @@
 	} 
 	AN(cli->cmd);
 	i = write(cli_o, cli->cmd, strlen(cli->cmd));
-	xxxassert(i == strlen(cli->cmd));
+	if (i != strlen(cli->cmd)) {
+		cli_result(cli, CLIS_COMMS);
+		cli_out(cli, "CLI communication error");
+		return;
+	}
 	i = write(cli_o, "\n", 1);
-	xxxassert(i == 1);
+	if (i != 1) {
+		cli_result(cli, CLIS_COMMS);
+		cli_out(cli, "CLI communication error");
+		return;
+	}
+		
+	assert(i == 1 || errno == EPIPE);
 	(void)cli_readres(cli_i,
 	    &u, &q, params->cli_timeout);
 	cli_result(cli, u);



More information about the varnish-commit mailing list