apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Travis <jtra...@covalent.net>
Subject Re: Unix missing fd 0..2, Win32 service missing stdin/out/err handles
Date Sun, 14 Apr 2002 08:30:57 GMT
On Sun, Apr 14, 2002 at 10:18:57AM +0200, Sascha Schumann wrote:
> > The operating system pre-allocates those fd's (0..2 for Unix) -- why would
> > opening an SDBM ever return any of those file descriptors?  The only way
> > would be if the consumer closed those handles beforehand.  If the user
> > does something like that, their program is broken -- we shouldn't try
> > to work around that.
> 
>     There are various daemons which close all fds after forking
>     and detaching from the tty, because they have no need to keep
>     those fds open.  open(), socket() or accept() can then return
>     an fd in the range 0..2.  If APR would be used in such a
>     context, the scenario Bill laid out would be quite possible.

As I described, it would be possible for a user to close those 
descriptors before doing something like say, opening an SDBM.  If
they then try to _write_ to those (via something like write() to
stderr), then that is a programming error which we should not be
trying to solve.

-- Jon


Mime
View raw message