Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!uwm.edu!rpi!uupsi!sunic!dkuug!freja.diku.dk!skinfaxe.diku.dk!seindal From: seindal@skinfaxe.diku.dk (Rene' Seindal) Newsgroups: comp.unix.wizards Subject: Re: more BSD strangeness -- syslogd.c Message-ID: <1990Jun11.114920.12382@diku.dk> Date: 11 Jun 90 11:49:20 GMT References: <1990Jun8.070904.7466@athena.mit.edu> <36447@sequent.UUCP> <3446@auspex.auspex.com> Sender: news@diku.dk (The Netnews System) Organization: Department Of Computer Science, University Of Copenhagen Lines: 20 hitz@auspex.auspex.com (Dave Hitz) writes: > This answers the question "why close all open files", but it doesn't > answer the question, "why open anything at all for descriptors 0, 1 and > 2." If it makes no reference to stdin, stdout, stderr, why must there > be something open for them? Because otherwise those file descriptors will be used for something else, such as log files or sockets, contrary to the usual conventions abount what the file descriptors 0, 1 and 2 means. > I can (and have) made up several answers for this. Anyone know the real > one? What happens if you just leave the descriptors closed? By Murphys Law, some braindead library routine will inevitably write stupid error messages in your log files or screw up the protocols you implement on top of a socket, that just happens to be file descriptor 2! Not an easy one to track down, and a lot of wasted time doing just that. Rene' Seindal (seindal@diku.dk)