summaryrefslogtreecommitdiff
path: root/relay
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>2001-04-05 22:44:23 +0000
committerTed Lemon <source@isc.org>2001-04-05 22:44:23 +0000
commitdfb6c5aa43999b1ce86b55b370af469fb7afd30d (patch)
treee77ef0dc686d7f0d53838817206858e08806e72e /relay
parent984d434c690dd291a8256452d72e0d5ca3d4d3ea (diff)
downloadisc-dhcp-dfb6c5aa43999b1ce86b55b370af469fb7afd30d.tar.gz
Make sure we have a stdin, stdout and stderr.
Diffstat (limited to 'relay')
-rw-r--r--relay/dhcrelay.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index daadec68..bb1302e2 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -3,7 +3,7 @@
DHCP/BOOTP Relay Agent. */
/*
- * Copyright (c) 1997-2000 Internet Software Consortium.
+ * Copyright (c) 1997-2001 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhcrelay.c,v 1.50 2001/02/26 22:21:14 mellon Exp $ Copyright (c) 1997-2000 Internet Software Consortium. All rights reserved.\n";
+"$Id: dhcrelay.c,v 1.51 2001/04/05 22:44:23 mellon Exp $ Copyright (c) 1997-2000 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -124,6 +124,16 @@ int main (argc, argv, envp)
isc_result_t status;
char *s;
+ /* Make sure we have stdin, stdout and stderr. */
+ i = open ("/dev/null", O_RDWR);
+ if (i == 0)
+ i = open ("/dev/null", O_RDWR);
+ if (i == 1) {
+ i = open ("/dev/null", O_RDWR);
+ log_perror = 0; /* No sense logging to /dev/null. */
+ } else if (i != -1)
+ close (i);
+
#ifdef SYSLOG_4_2
openlog ("dhcrelay", LOG_NDELAY);
log_priority = LOG_DAEMON;