From: Ted Lemon Date: Thu, 5 Apr 2001 22:52:48 +0000 (+0000) Subject: Make sure we have a stdin, stdout and stderr. X-Git-Tag: V3-BETA-2-PATCH-24~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb5f87935616067baba656857d1e7fafc71df941;p=thirdparty%2Fdhcp.git Make sure we have a stdin, stdout and stderr. --- diff --git a/server/dhcpd.c b/server/dhcpd.c index 3504565aa..fadad829c 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -43,7 +43,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhcpd.c,v 1.113 2001/03/01 22:11:50 mellon Exp $ Copyright 1995-2001 Internet Software Consortium."; +"$Id: dhcpd.c,v 1.114 2001/04/05 22:52:48 mellon Exp $ Copyright 1995-2001 Internet Software Consortium."; #endif static char copyright[] = @@ -215,6 +215,16 @@ int main (argc, argv, envp) char *traceoutfile = (char *)0; #endif + /* Make sure we have stdin, stdout and stderr. */ + status = open ("/dev/null", O_RDWR); + if (status == 0) + status = open ("/dev/null", O_RDWR); + if (status == 1) { + status = open ("/dev/null", O_RDWR); + log_perror = 0; /* No sense logging to /dev/null. */ + } else if (status != -1) + close (status); + /* Set up the client classification system. */ classification_setup ();