summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwill <will@FreeBSD.org>2007-03-08 07:00:42 +0000
committerwill <will@FreeBSD.org>2007-03-08 07:00:42 +0000
commit03b6c30cc05e5c72139603443e760da347189a27 (patch)
tree20e5fc7c79bfef69b30a43e8a84e57e1c1ea9557
parent80d6cde009b5766eaf8fb0ee64deb32113487939 (diff)
downloadFreeBSD-src-03b6c30cc05e5c72139603443e760da347189a27.zip
FreeBSD-src-03b6c30cc05e5c72139603443e760da347189a27.tar.gz
Fix a bug where HOME was not allowed to be overridden by an user's crontab
as crontab(5) states it can be. This is supported by all vixie-cron derived implementations; not sure why FreeBSD was any different. PR: bin/106442 MFC after: 2 weeks
-rw-r--r--usr.sbin/cron/lib/entry.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.sbin/cron/lib/entry.c b/usr.sbin/cron/lib/entry.c
index d24aadb..7269152 100644
--- a/usr.sbin/cron/lib/entry.c
+++ b/usr.sbin/cron/lib/entry.c
@@ -351,14 +351,16 @@ load_entry(file, error_func, pw, envp)
goto eof;
}
}
- prev_env = e->envp;
- sprintf(envstr, "HOME=%s", pw->pw_dir);
- e->envp = env_set(e->envp, envstr);
- if (e->envp == NULL) {
- warn("env_set(%s)", envstr);
- env_free(prev_env);
- ecode = e_mem;
- goto eof;
+ if (!env_get("HOME", e->envp)) {
+ prev_env = e->envp;
+ sprintf(envstr, "HOME=%s", pw->pw_dir);
+ e->envp = env_set(e->envp, envstr);
+ if (e->envp == NULL) {
+ warn("env_set(%s)", envstr);
+ env_free(prev_env);
+ ecode = e_mem;
+ goto eof;
+ }
}
if (!env_get("PATH", e->envp)) {
prev_env = e->envp;
OpenPOWER on IntegriCloud