diff options
Diffstat (limited to 'miscutils/crond.c')
-rw-r--r-- | miscutils/crond.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c index 6c54e1a8f..cf3323090 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -153,6 +153,7 @@ struct globals { | |||
153 | const char *log_filename; | 153 | const char *log_filename; |
154 | const char *crontab_dir_name; /* = CRONTABS; */ | 154 | const char *crontab_dir_name; /* = CRONTABS; */ |
155 | CronFile *cron_files; | 155 | CronFile *cron_files; |
156 | char *default_shell; | ||
156 | #if SETENV_LEAKS | 157 | #if SETENV_LEAKS |
157 | char *env_var_user; | 158 | char *env_var_user; |
158 | char *env_var_home; | 159 | char *env_var_home; |
@@ -700,7 +701,7 @@ fork_job(const char *user, int mailFd, CronLine *line, bool run_sendmail) | |||
700 | goto err; | 701 | goto err; |
701 | } | 702 | } |
702 | 703 | ||
703 | shell = line->cl_shell ? line->cl_shell : DEFAULT_SHELL; | 704 | shell = line->cl_shell ? line->cl_shell : G.default_shell; |
704 | prog = run_sendmail ? SENDMAIL : shell; | 705 | prog = run_sendmail ? SENDMAIL : shell; |
705 | 706 | ||
706 | set_env_vars(pas, shell); | 707 | set_env_vars(pas, shell); |
@@ -846,7 +847,7 @@ static pid_t start_one_job(const char *user, CronLine *line) | |||
846 | } | 847 | } |
847 | 848 | ||
848 | /* Prepare things before vfork */ | 849 | /* Prepare things before vfork */ |
849 | shell = line->cl_shell ? line->cl_shell : DEFAULT_SHELL; | 850 | shell = line->cl_shell ? line->cl_shell : G.default_shell; |
850 | set_env_vars(pas, shell); | 851 | set_env_vars(pas, shell); |
851 | 852 | ||
852 | /* Fork as the user in question and run program */ | 853 | /* Fork as the user in question and run program */ |
@@ -1045,6 +1046,10 @@ int crond_main(int argc UNUSED_PARAM, char **argv) | |||
1045 | 1046 | ||
1046 | reopen_logfile_to_stderr(); | 1047 | reopen_logfile_to_stderr(); |
1047 | xchdir(G.crontab_dir_name); | 1048 | xchdir(G.crontab_dir_name); |
1049 | /* $SHELL, or current UID's shell, or DEFAULT_SHELL */ | ||
1050 | /* Useful on Android where DEFAULT_SHELL /bin/sh may not exist */ | ||
1051 | G.default_shell = xstrdup(get_shell_name()); | ||
1052 | |||
1048 | log8("crond (busybox "BB_VER") started, log level %d", G.log_level); | 1053 | log8("crond (busybox "BB_VER") started, log level %d", G.log_level); |
1049 | rescan_crontab_dir(); | 1054 | rescan_crontab_dir(); |
1050 | write_pidfile(CONFIG_PID_FILE_PATH "/crond.pid"); | 1055 | write_pidfile(CONFIG_PID_FILE_PATH "/crond.pid"); |