"Miquel van Smoorenburg" <[EMAIL PROTECTED]> wrote: > It can get worse. If you close(STDOUT_FILENO) and/or STDERR_FILENO, > then the next open will get fd#1 or fd#2. That could be your SQL > socket, or whatever. Now anything that calls printf() or perror() > or something (some libc routines do! yuck!) will write to a random > filedescriptor. > > I've seen linux mount corrupt the /etc/mtab it wrote because of this.
That's evil... > Imagine what happens if one of the filedescriptors is already closed. > The last line should read if (devnull > 2) close(devnull); What bothers me is *why* one of the file descriptors would already be closed. I'll still add the fix, though. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
