more BSD strangeness -- syslogd.c

Jonathan I. Kamens jik at athena.mit.edu
Fri Jun 8 17:09:04 AEST 1990


  Here's another little gem of code from BSD4.3 that I don't quite
understand.  Pulled from etc/syslogd.c:

	if (!Debug) {
		if (fork())
			exit(0);
		for (i = 0; i < 10; i++)
			(void) close(i);
		(void) open("/", 0);
		(void) dup2(0, 1);
		(void) dup2(0, 2);
		untty();
	}

OK, so why is it opening "/"?  Is this a poor man's equivalent to
/dev/null, and if so, why doesn't it just open /dev/null?

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710



More information about the Comp.unix.wizards mailing list