[4.1] 5d935b1 Use VSUB_closefrom()

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


commit 5d935b1ab207b9944ff475972a91ca9a4f7d25e9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jan 6 13:48:58 2016 +0000

    Use VSUB_closefrom()

diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c
index 8770b5f..f63c2e5 100644
--- a/bin/varnishtest/vtc_process.c
+++ b/bin/varnishtest/vtc_process.c
@@ -42,6 +42,7 @@
 #include <unistd.h>
 
 #include "vtc.h"
+#include "vsub.h"
 
 struct process {
 	unsigned		magic;
@@ -183,7 +184,7 @@ static void
 process_start(struct process *p)
 {
 	struct vsb *cl;
-	int i, out_fd, err_fd;
+	int out_fd, err_fd;
 
 	CHECK_OBJ_NOTNULL(p, PROCESS_MAGIC);
 
@@ -203,8 +204,7 @@ process_start(struct process *p)
 		assert(dup2(p->fds[0], 0) == 0);
 		assert(dup2(out_fd, 1) == 1);
 		assert(dup2(err_fd, 2) == 2);
-		for (i = sysconf(_SC_OPEN_MAX); i > STDERR_FILENO; i--)
-			(void)close(i);
+		VSUB_closefrom(STDERR_FILENO + 1);
 		AZ(execl("/bin/sh", "/bin/sh", "-c", VSB_data(cl), (char*)0));
 		exit(1);
 	}



More information about the varnish-commit mailing list