From c2ee1dcc02035d781d6c70f06df7106979a9f870 Mon Sep 17 00:00:00 2001 From: obrien Date: Sat, 9 Dec 2000 09:35:55 +0000 Subject: Add `_PATH_DEVZERO'. Use _PATH_* where where possible. --- usr.sbin/cron/cron/popen.c | 7 ++++--- usr.sbin/cron/crontab/crontab.c | 5 +++-- usr.sbin/cron/lib/compat.c | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'usr.sbin/cron') diff --git a/usr.sbin/cron/cron/popen.c b/usr.sbin/cron/cron/popen.c index 1ac775d..f22f421 100644 --- a/usr.sbin/cron/cron/popen.c +++ b/usr.sbin/cron/cron/popen.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include "cron.h" #include #include +#include #if defined(SYSLOG) # include #endif @@ -130,7 +131,7 @@ cron_popen(program, type, e) if (*type == 'r') { /* Do not share our parent's stdin */ (void)close(0); - (void)open("/dev/null", O_RDWR); + (void)open(_PATH_DEVNULL, O_RDWR); if (pdes[1] != 1) { dup2(pdes[1], 1); dup2(pdes[1], 2); /* stderr, too! */ @@ -144,9 +145,9 @@ cron_popen(program, type, e) } /* Hack: stdout gets revoked */ (void)close(1); - (void)open("/dev/null", O_RDWR); + (void)open(_PATH_DEVNULL, O_RDWR); (void)close(2); - (void)open("/dev/null", O_RDWR); + (void)open(_PATH_DEVNULL, O_RDWR); (void)close(pdes[1]); } # if defined(LOGIN_CAP) diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c index 0071f6a..8ee2ccb 100644 --- a/usr.sbin/cron/crontab/crontab.c +++ b/usr.sbin/cron/crontab/crontab.c @@ -31,6 +31,7 @@ static const char rcsid[] = #include "cron.h" #include #include +#include #include #include #ifdef USE_UTIMES @@ -297,8 +298,8 @@ edit_cmd() { if (errno != ENOENT) err(ERROR_EXIT, "%s", n); warnx("no crontab for %s - using an empty one", User); - if (!(f = fopen("/dev/null", "r"))) - err(ERROR_EXIT, "/dev/null"); + if (!(f = fopen(_PATH_DEVNULL, "r"))) + err(ERROR_EXIT, _PATH_DEVNULL); } um = umask(077); diff --git a/usr.sbin/cron/lib/compat.c b/usr.sbin/cron/lib/compat.c index 6057b86..9686012 100644 --- a/usr.sbin/cron/lib/compat.c +++ b/usr.sbin/cron/lib/compat.c @@ -32,6 +32,7 @@ static char rcsid[] = "$FreeBSD$"; # include #endif #include +#include /* the code does not depend on any of vfork's @@ -109,7 +110,7 @@ setsid() # else newpgrp = setpgrp(0, getpid()); # endif - if ((fd = open("/dev/tty", 2)) >= 0) + if ((fd = open(_PATH_TTY, 2)) >= 0) { (void) ioctl(fd, TIOCNOTTY, (char*)0); (void) close(fd); @@ -117,9 +118,9 @@ setsid() # else /*BSD*/ newpgrp = setpgrp(); - (void) close(STDIN); (void) open("/dev/null", 0); - (void) close(STDOUT); (void) open("/dev/null", 1); - (void) close(STDERR); (void) open("/dev/null", 2); + (void) close(STDIN); (void) open(_PATH_DEVNULL, 0); + (void) close(STDOUT); (void) open(_PATH_DEVNULL, 1); + (void) close(STDERR); (void) open(_PATH_DEVNULL, 2); # endif /*BSD*/ return newpgrp; } -- cgit v1.1