From: Tomas Mraz Date: Fri, 11 Mar 2011 13:06:26 +0000 (+0100) Subject: Rename set_cron_cwd() to check_spool_dir() as we do not do any chdir X-Git-Tag: cronie1.4.7~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=285ddb27765cab5f52605f6df3e5ad85a80e81fb;p=cronie Rename set_cron_cwd() to check_spool_dir() as we do not do any chdir anymore. --- diff --git a/src/cron.c b/src/cron.c index ffa919f..955b1b0 100644 --- a/src/cron.c +++ b/src/cron.c @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) { acquire_daemonlock(0); set_cron_uid(); - set_cron_cwd(); + check_spool_dir(); if (putenv("PATH=" _PATH_DEFPATH) < 0) { log_it("CRON", pid, "DEATH", "can't putenv PATH", errno); diff --git a/src/crontab.c b/src/crontab.c index 1a91dfc..f6a5e51 100644 --- a/src/crontab.c +++ b/src/crontab.c @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) { argv[1] = n; } parse_args(argc, argv); /* sets many globals, opens a file */ - set_cron_cwd(); + check_spool_dir(); if (!allowed(RealUser, CRON_ALLOW, CRON_DENY)) { fprintf(stderr, "You (%s) are not allowed to use this program (%s)\n", @@ -304,10 +304,6 @@ static void parse_args(int argc, char *argv[]) { } if (Option == opt_replace) { - /* we have to open the file here because we're going to - * chdir(2) into /var/cron before we get around to - * reading the file. - */ if (!strcmp(Filename, "-")) NewCrontab = stdin; else { diff --git a/src/funcs.h b/src/funcs.h index f0e576e..afecedd 100644 --- a/src/funcs.h +++ b/src/funcs.h @@ -25,7 +25,7 @@ */ void set_cron_uid(void), - set_cron_cwd(void), + check_spool_dir(void), open_logfile(void), sigpipe_func(void), job_add(entry *, user *), diff --git a/src/misc.c b/src/misc.c index dbe4952..f640f29 100644 --- a/src/misc.c +++ b/src/misc.c @@ -222,7 +222,7 @@ void set_cron_uid(void) { #endif } -void set_cron_cwd(void) { +void check_spool_dir(void) { struct stat sb; struct group *grp = NULL;