[master] 855b3c7c1 Report stdout+stderr from the child if it fails to launch.

Poul-Henning Kamp phk at FreeBSD.org
Wed Mar 16 16:04:07 UTC 2022


commit 855b3c7c1941443145087007f79e35139c5016e7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Mar 16 16:03:22 2022 +0000

    Report stdout+stderr from the child if it fails to launch.

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 17c80cf67..ecacb49d2 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -414,21 +414,22 @@ mgt_launch_child(struct cli *cli)
 	MCH_Fd_Inherit(heritage.cli_out, NULL);
 	closefd(&heritage.cli_out);
 
+	child_std_vlu = VLU_New(child_line, NULL, 0);
+	AN(child_std_vlu);
+
 	/* Wait for cache/cache_cli.c::CLI_Run() to check in */
 	if (VCLI_ReadResult(child_cli_in, &u, NULL, mgt_param.cli_timeout)) {
 		assert(u == CLIS_COMMS);
 		pidr = waitpid(pid, &i, 0);
 		assert(pidr == pid);
-		perror("Child failed on launch");
+		(void)VLU_Fd(child_std_vlu, child_output);
+		MGT_Complain(C_ERR, "Child failed on launch");
 		exit(1);		// XXX Harsh ?
 	} else {
 		assert(u == CLIS_OK);
 		fprintf(stderr, "Child launched OK\n");
 	}
 
-	child_std_vlu = VLU_New(child_line, NULL, 0);
-	AN(child_std_vlu);
-
 	AZ(ev_listen);
 	e = VEV_Alloc();
 	XXXAN(e);


More information about the varnish-commit mailing list