.TP
.B "\-x"
This option allows you to set debug flags.
+.TP
+.B "\-P"
+Don't set PATH. PATH is instead inherited from the environment.
.SH SIGNALS
When the \s-2SIGHUP\s+2 is received, the
.I Cron
SyslogOutput = 0;
NoFork = 0;
+ ChangePath = 1;
parse_args(argc, argv);
bzero((char *) &sact, sizeof sact);
set_cron_uid();
check_spool_dir();
- if (putenv("PATH=" _PATH_DEFPATH) < 0) {
- log_it("CRON", pid, "DEATH", "can't putenv PATH", errno);
- exit(1);
+ if (ChangePath) {
+ if (putenv("PATH=" _PATH_DEFPATH) < 0) {
+ log_it("CRON", pid, "DEATH", "can't putenv PATH",
+ errno);
+ exit(1);
+ }
}
/* Get the default locale character set for the mail
static void parse_args(int argc, char *argv[]) {
int argch;
- while (-1 != (argch = getopt(argc, argv, "hnpsix:m:c"))) {
+ while (-1 != (argch = getopt(argc, argv, "hnpsiPx:m:c"))) {
switch (argch) {
case 'x':
if (!set_debug_flags(optarg))
case 'i':
DisableInotify = 1;
break;
+ case 'P':
+ ChangePath = 0;
+ break;
case 'm':
strncpy(MailCmd, optarg, MAX_COMMAND);
break;
}
#ifndef LOGIN_CAP
/* If login.conf is in used we will get the default PATH later. */
- if (!env_get("PATH", e->envp)) {
+ if (ChangePath && !env_get("PATH", e->envp)) {
if (glue_strings(envstr, sizeof envstr, "PATH", _PATH_DEFPATH, '=')) {
if ((tenvp = env_set(e->envp, envstr)) == NULL) {
ecode = e_memory;
XTRN char MailCmd[MAX_COMMAND];
XTRN char cron_default_mail_charset[MAX_ENVSTR];
XTRN int EnableClustering;
+XTRN int ChangePath;
#if DEBUGGING
XTRN int DebugFlags INIT(0);