summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron/cron.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/cron/cron.c')
-rw-r--r--usr.sbin/cron/cron.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c
index a2ce0eba63a..5cc8a5458f5 100644
--- a/usr.sbin/cron/cron.c
+++ b/usr.sbin/cron/cron.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cron.c,v 1.15 2001/08/11 20:47:14 millert Exp $ */
+/* $OpenBSD: cron.c,v 1.16 2001/10/24 17:28:16 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
*/
@@ -21,7 +21,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$OpenBSD: cron.c,v 1.15 2001/08/11 20:47:14 millert Exp $";
+static char rcsid[] = "$OpenBSD: cron.c,v 1.16 2001/10/24 17:28:16 millert Exp $";
#endif
#define MAIN_PROGRAM
@@ -57,6 +57,7 @@ int
main(int argc, char *argv[]) {
cron_db database;
struct sigaction sact;
+ int fd;
ProgramName = argv[0];
@@ -105,6 +106,13 @@ main(int argc, char *argv[]) {
/* child process */
log_it("CRON",getpid(),"STARTUP","fork ok");
(void) setsid();
+ if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ (void) dup2(fd, STDIN);
+ (void) dup2(fd, STDOUT);
+ (void) dup2(fd, STDERR);
+ if (fd > STDERR)
+ (void) close(fd);
+ }
break;
default:
/* parent process should just die */