[master] 67399b6 Don't close stdout/stderr when we stop due to EOF on stdin in -d mode.

Poul-Henning Kamp phk at FreeBSD.org
Wed Jan 6 17:39:05 CET 2016


commit 67399b63c6bf14a8fb3a9791d0fc2a3cd02707da
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jan 6 16:22:44 2016 +0000

    Don't close stdout/stderr when we stop due to EOF on stdin in -d mode.
    
    That obscured problems in cleanup

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index c54ac60..a7533e9 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -355,12 +355,6 @@ cli_stdin_close(void *priv)
 {
 
 	(void)priv;
-	(void)close(0);
-	(void)close(1);
-	(void)close(2);
-	AZ(open("/dev/null", O_RDONLY));
-	assert(open("/dev/null", O_WRONLY) == 1);
-	assert(open("/dev/null", O_WRONLY) == 2);
 
 	if (d_flag) {
 		mgt_stop_child();
@@ -368,6 +362,13 @@ cli_stdin_close(void *priv)
 		if (pfh != NULL)
 			(void)VPF_Remove(pfh);
 		exit(0);
+	} else {
+		(void)close(0);
+		(void)close(1);
+		(void)close(2);
+		AZ(open("/dev/null", O_RDONLY));
+		assert(open("/dev/null", O_WRONLY) == 1);
+		assert(open("/dev/null", O_WRONLY) == 2);
 	}
 }
 



More information about the varnish-commit mailing list