r4210 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Aug 26 13:12:48 CEST 2009


Author: phk
Date: 2009-08-26 13:12:48 +0200 (Wed, 26 Aug 2009)
New Revision: 4210

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_child.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Factor getdtablesize() out of close loop.



Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c	2009-08-26 07:25:54 UTC (rev 4209)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c	2009-08-26 11:12:48 UTC (rev 4210)
@@ -235,7 +235,7 @@
 	unsigned u;
 	char *p;
 	struct vev *e;
-	int i, cp[2];
+	int i, j, cp[2];
 
 	if (child_state != CH_STOPPED && child_state != CH_DIED)
 		return;
@@ -303,7 +303,8 @@
 		/* Close anything we shouldn't know about */
 		closelog();
 		printf("Closed fds:");
-		for (i = STDERR_FILENO + 1; i < getdtablesize(); i++) {
+		j = getdtablesize();
+		for (i = STDERR_FILENO + 1; i < j; i++) {
 			if (vbit_test(fd_map, i))
 				continue;
 			if (close(i) == 0)

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2009-08-26 07:25:54 UTC (rev 4209)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2009-08-26 11:12:48 UTC (rev 4210)
@@ -314,7 +314,8 @@
 	pipes[1][1] = 1;
 
 	/* close the rest */
-	for (i = 5; i < getdtablesize(); i++)
+	j = getdtablesize();
+	for (i = 5; i < j; i++)
 		(void)close(i);
 
 	pfd[0].fd = pipes[0][0];



More information about the varnish-commit mailing list