diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-10-24 17:28:17 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-10-24 17:28:17 +0000 |
commit | b63d94eeb32cdb0f74aee4d49dd45475cb621be8 (patch) | |
tree | 11d5d97b952a624af67c4317d58d6f556f430da9 /usr.sbin/cron/crontab.c | |
parent | 3304ae07e128acca74b601e043df6f543a59509f (diff) |
When becoming a daemon, dup stdin, stdout, and stderr to /dev/null
Change an unsafe vfork() to fork()
Fix dup2() usage--must check for oldd == newd case and no need to close oldd
Fixes annoying messages from sendmail about stdout being closed.
Diffstat (limited to 'usr.sbin/cron/crontab.c')
-rw-r--r-- | usr.sbin/cron/crontab.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index fee68e0670a..e3cc15b630a 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crontab.c,v 1.22 2001/08/19 18:30:38 millert Exp $ */ +/* $OpenBSD: crontab.c,v 1.23 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: crontab.c,v 1.22 2001/08/19 18:30:38 millert Exp $"; +static char rcsid[] = "$OpenBSD: crontab.c,v 1.23 2001/10/24 17:28:16 millert Exp $"; #endif /* crontab - install and manage per-user crontab files @@ -303,8 +303,8 @@ edit_cmd(void) { } fprintf(stderr, "no crontab for %s - using an empty one\n", User); - if (!(f = fopen("/dev/null", "r"))) { - perror("/dev/null"); + if (!(f = fopen(_PATH_DEVNULL, "r"))) { + perror(_PATH_DEVNULL); exit(ERROR_EXIT); } } |