Re: Close() in daemon loop

From: Robert Collins <robert.collins@dont-contact.us>
Date: Fri, 7 Jul 2000 09:43:29 +1000

In the cygwin branch I have started the second loop at 3, I'll alter it to
exclude 2 from the close calls.

Rob

----- Original Message -----
From: "Duane Wessels" <wessels@ircache.net>
To: "Robert Collins" <robert.collins@itdomain.com.au>
Cc: <squid-dev@squid-cache.org>
Sent: Friday, July 07, 2000 8:39 AM
Subject: Re: Close() in daemon loop

>
>
>
> On Fri, 7 Jul 2000, Robert Collins wrote:
>
> > A little more: further up in main, there is a loop:
> >
> > if (opt_catch_signals)
> > for (n = Squid_MaxFD; n > 2; n--)
> > close(n);
> >
> > My question is: why does this (very similar) loop stop at 3, and the
other
> > start at 0, instead of 3?
>
> The difference is that in the above case, Squid might not
> become a daemon process, so we want stdout, stderr open for
> debugging purposes.
>
> In watch_child(), squid is becoming a daemon. Its standard
> practice to close all descriptors when becoming a daemon
> process.
>
> If NT/cygwin requires FD 2 to remain open, then we can
> work around it.
>
>
Received on Thu Jul 06 2000 - 17:39:28 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:32 MST