Re: [exim-dev] [patch] please consider closing all fds on da…

Top Page
Delete this message
Reply to this message
Author: Tony Finch
Date:  
To: Michael Haardt
CC: exim-dev
Subject: Re: [exim-dev] [patch] please consider closing all fds on daemon startup (was: Changes in the daemon startup code, fd's not properly closed?)
On Wed, 2 Mar 2005, Michael Haardt wrote:
> On Wed, Mar 02, 2005 at 10:14:48AM +0000, Tony Finch wrote:
> > On Wed, 2 Mar 2005, Philip Hazel wrote:
> >
> > > Opinions, please.
> >
> > Daemons should be started from a clean environment that has either closed
> > all fds or has set their close-on-exec flag.
>
> Why?
>
> Exim works fine as it is and closing all file descriptors, not knowing
> what they do, annoys subsystems that use them, e.g. debug libraries
> linked to the daemon.


The surrounding code usually has a better idea of how to clean its
environment than the daemon it is invoking. Your example is a good reason
for doing the cleaning in the invoking code rather than in the daemon
itself.

This is one of the areas in which Unix is not very good.

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}