apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@apache.org>
Subject RE: Unix missing fd 0..2, Win32 service missing stdin/out/err handles
Date Sun, 14 Apr 2002 21:39:00 GMT
> From: Sascha Schumann [mailto:sascha@schumann.cx]
> Sent: 14 April 2002 22:46

> > If a user knows that a third-party library (Oracle, whatever) can
> > provide messages to stderr, and they knowingly close that file
> > descriptor without dup()ing it elsewhere, then that is a bug in
> > their software.
> 
>     Note that the author of the non-apr application does not
>     necessarily must submit to that wisdom.  While you are
>     theoritecally correct, it matters little practically.
> 
> > Having APR open a bunch of file-descriptors so
> > that this fixes a potential problem (IMO bug in their software)
> > is just wasting file descriptors.
> 
>     Not really.  (error handling excluded)
> 
>     do {
>         fd = open("/dev/null", O_RDWR);
>     } while (fd < 3);
>     close(fd);

And this is what most daemons (mostly) do.  We could create a
convenience function for this.  I don't think it should be default
apr behaviour though.  APR is a library.  Libraries shouldn't
take options away from users.

Sander


Mime
View raw message