summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-12-09 09:35:55 +0000
committerobrien <obrien@FreeBSD.org>2000-12-09 09:35:55 +0000
commitc2ee1dcc02035d781d6c70f06df7106979a9f870 (patch)
tree757810dc1fdd19be4c8125ccb9e8beb1aff3d929 /usr.sbin/cron
parentc174181f432119d1dae3f5e58ecc14c8d7b6f545 (diff)
downloadFreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.zip
FreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.tar.gz
Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r--usr.sbin/cron/cron/popen.c7
-rw-r--r--usr.sbin/cron/crontab/crontab.c5
-rw-r--r--usr.sbin/cron/lib/compat.c9
3 files changed, 12 insertions, 9 deletions
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 <sys/signal.h>
#include <fcntl.h>
+#include <paths.h>
#if defined(SYSLOG)
# include <syslog.h>
#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 <errno.h>
#include <fcntl.h>
+#include <paths.h>
#include <sys/file.h>
#include <sys/stat.h>
#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 <sys/ioctl.h>
#endif
#include <errno.h>
+#include <paths.h>
/* 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;
}
OpenPOWER on IntegriCloud