Commit 30dd8521 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Factor getdtablesize() out of close loop.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4210 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 566debe2
......@@ -235,7 +235,7 @@ start_child(struct cli *cli)
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 @@ start_child(struct cli *cli)
/* 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)
......
......@@ -314,7 +314,8 @@ DebugStunt(void)
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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment