Close the standard file descriptors (stdin, stdout, and stderr) when

compiling in production mode (no debugging information.)
This commit is contained in:
Robert James Kaes 2004-08-10 03:38:13 +00:00
parent c6711d7d38
commit 4a8c4d55f0

View File

@ -1,4 +1,4 @@
/* $Id: daemon.c,v 1.2 2002-10-03 20:38:06 rjkaes Exp $ /* $Id: daemon.c,v 1.2.2.1 2004-08-10 03:38:13 rjkaes Exp $
* *
* This file contains functions which are useful when writing a * This file contains functions which are useful when writing a
* daemon process. The functions include a "makedaemon" function and * daemon process. The functions include a "makedaemon" function and
@ -40,7 +40,11 @@ makedaemon(void)
chdir("/"); chdir("/");
umask(077); umask(077);
#if 0 #if NDEBUG
/*
* When not in debugging mode, close the standard file
* descriptors.
*/
close(0); close(0);
close(1); close(1);
close(2); close(2);