From dc4e75ef7ca135c836d22e380847672cf5b3773b Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Tue, 2 Sep 2003 02:36:18 +0000 Subject: move all "-/bin/sh" "/bin/sh" and "sh" to libbb/messages.c file as one constant. Vodz last_patch_107 --- miscutils/crond.c | 13 +++++-------- miscutils/crontab.c | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'miscutils') diff --git a/miscutils/crond.c b/miscutils/crond.c index f0920136f..637e09dd8 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c @@ -54,9 +54,6 @@ #define MAXLINES 256 /* max lines in non-root crontabs */ #endif -static const char def_sh[] = "/bin/sh"; - - typedef struct CronFile { struct CronFile *cf_Next; struct CronLine *cf_LineBase; @@ -313,7 +310,7 @@ ChangeUser(const char *user) } setenv("USER", pas->pw_name, 1); setenv("HOME", pas->pw_dir, 1); - setenv("SHELL", def_sh, 1); + setenv("SHELL", DEFAULT_SHELL, 1); /* * Change running state to the user in question @@ -997,7 +994,7 @@ RunJob(const char *user, CronLine *line) user, mailFile); } - ForkJob(user, line, mailFd, def_sh, "-c", line->cl_Shell, mailFile); + ForkJob(user, line, mailFd, DEFAULT_SHELL, "-c", line->cl_Shell, mailFile); } /* @@ -1081,12 +1078,12 @@ RunJob(const char *user, CronLine *line) #ifdef FEATURE_DEBUG_OPT if (DebugOpt) - crondlog("\005Child Running %s\n", def_sh); + crondlog("\005Child Running %s\n", DEFAULT_SHELL); #endif - execl(def_sh, def_sh, "-c", line->cl_Shell, NULL); + execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", line->cl_Shell, NULL); crondlog("\024unable to exec, user %s cmd %s -c %s\n", user, - def_sh, line->cl_Shell); + DEFAULT_SHELL, line->cl_Shell); exit(0); } else if (pid < 0) { /* diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 6b9446464..6c4da95fe 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c @@ -320,7 +320,7 @@ EditFile(const char *user, const char *file) ptr = PATH_VI; snprintf(visual, sizeof(visual), "%s %s", ptr, file); - execl("/bin/sh", "/bin/sh", "-c", visual, NULL); + execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", visual, NULL); perror("exec"); exit(0); } @@ -360,7 +360,7 @@ ChangeUser(const char *user, short dochdir) } setenv("USER", pas->pw_name, 1); setenv("HOME", pas->pw_dir, 1); - setenv("SHELL", "/bin/sh", 1); + setenv("SHELL", DEFAULT_SHELL, 1); /* * Change running state to the user in question -- cgit v1.2.1