[4.1] c1f8013 Another use for VSUB_closefrom()

Lasse Karstensen lkarsten at varnish-software.com
Thu Jan 14 15:15:11 CET 2016


commit c1f801315268ee2984d4dffca4ddd4b1cc200499
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jan 6 14:01:19 2016 +0000

    Another use for VSUB_closefrom()

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 9c9f255..601f245 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -51,6 +51,7 @@
 #include "vrnd.h"
 #include "vsa.h"
 #include "vss.h"
+#include "vsub.h"
 #include "vtcp.h"
 #include "vtim.h"
 
@@ -232,7 +233,7 @@ static void
 start_test(void)
 {
 	struct vtc_tst *tp;
-	int p[2], sfd, retval;
+	int p[2], retval;
 	struct vtc_job *jp;
 	char tmpdir[PATH_MAX];
 
@@ -274,8 +275,7 @@ start_test(void)
 		assert(open("/dev/null", O_RDONLY) == STDIN_FILENO);
 		assert(dup2(p[1], STDOUT_FILENO) == STDOUT_FILENO);
 		assert(dup2(p[1], STDERR_FILENO) == STDERR_FILENO);
-		for (sfd = STDERR_FILENO + 1; sfd < 100; sfd++)
-			(void)close(sfd);
+		VSUB_closefrom(STDERR_FILENO + 1);
 		retval = exec_file(jp->tst->filename, jp->tst->script,
 		    jp->tmpdir, jp->buf, jp->bufsiz);
 		exit(retval);



More information about the varnish-commit mailing list