libbb: rename run_shell() to exec_shell()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
b4f93f562d
commit
2075aa93e0
@ -1140,7 +1140,6 @@ int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC;
|
|||||||
#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
|
#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
void BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC;
|
void BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC;
|
||||||
void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
|
|
||||||
|
|
||||||
/* xvfork() can't be a _function_, return after vfork in child mangles stack
|
/* xvfork() can't be a _function_, return after vfork in child mangles stack
|
||||||
* in the parent. It must be a macro. */
|
* in the parent. It must be a macro. */
|
||||||
@ -1607,7 +1606,8 @@ void bb_do_delay(unsigned seconds) FAST_FUNC;
|
|||||||
void msleep(unsigned ms) FAST_FUNC;
|
void msleep(unsigned ms) FAST_FUNC;
|
||||||
void sleep1(void) FAST_FUNC;
|
void sleep1(void) FAST_FUNC;
|
||||||
void change_identity(const struct passwd *pw) FAST_FUNC;
|
void change_identity(const struct passwd *pw) FAST_FUNC;
|
||||||
void run_shell(const char *shell, int loginshell, const char **args) NORETURN FAST_FUNC;
|
void exec_shell(const char *shell, int loginshell, const char **args) NORETURN FAST_FUNC;
|
||||||
|
void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
|
||||||
|
|
||||||
/* Returns $SHELL, getpwuid(getuid())->pw_shell, or DEFAULT_SHELL.
|
/* Returns $SHELL, getpwuid(getuid())->pw_shell, or DEFAULT_SHELL.
|
||||||
* Note that getpwuid result might need xstrdup'ing
|
* Note that getpwuid result might need xstrdup'ing
|
||||||
|
@ -91,12 +91,3 @@ void FAST_FUNC BB_EXECVP_or_die(char **argv)
|
|||||||
xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
|
xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
|
||||||
bb_perror_msg_and_die("can't execute '%s'", argv[0]);
|
bb_perror_msg_and_die("can't execute '%s'", argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Typical idiom for applets which exec *optional* PROG [ARGS] */
|
|
||||||
void FAST_FUNC exec_prog_or_SHELL(char **argv)
|
|
||||||
{
|
|
||||||
if (argv[0]) {
|
|
||||||
BB_EXECVP_or_die(argv);
|
|
||||||
}
|
|
||||||
run_shell(getenv("SHELL"), /*login:*/ 1, NULL);
|
|
||||||
}
|
|
||||||
|
@ -48,10 +48,10 @@ void FAST_FUNC set_current_security_context(security_context_t sid)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Run SHELL, or DEFAULT_SHELL if SHELL is "" or NULL.
|
/* Exec SHELL, or DEFAULT_SHELL if SHELL is "" or NULL.
|
||||||
* If ADDITIONAL_ARGS is not NULL, pass them to the shell.
|
* If ADDITIONAL_ARGS is not NULL, pass them to the shell.
|
||||||
*/
|
*/
|
||||||
void FAST_FUNC run_shell(const char *shell, int loginshell, const char **additional_args)
|
void FAST_FUNC exec_shell(const char *shell, int loginshell, const char **additional_args)
|
||||||
{
|
{
|
||||||
const char **args;
|
const char **args;
|
||||||
|
|
||||||
@ -84,3 +84,12 @@ void FAST_FUNC run_shell(const char *shell, int loginshell, const char **additio
|
|||||||
execv(shell, (char **) args);
|
execv(shell, (char **) args);
|
||||||
bb_perror_msg_and_die("can't execute '%s'", shell);
|
bb_perror_msg_and_die("can't execute '%s'", shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Typical idiom for applets which exec *optional* PROG [ARGS] */
|
||||||
|
void FAST_FUNC exec_prog_or_SHELL(char **argv)
|
||||||
|
{
|
||||||
|
if (argv[0]) {
|
||||||
|
BB_EXECVP_or_die(argv);
|
||||||
|
}
|
||||||
|
exec_shell(getenv("SHELL"), /*login:*/ 1, NULL);
|
||||||
|
}
|
||||||
|
@ -602,7 +602,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
|
|
||||||
/* Exec login shell with no additional parameters */
|
/* Exec login shell with no additional parameters */
|
||||||
run_shell(pw->pw_shell, 1, NULL);
|
exec_shell(pw->pw_shell, 1, NULL);
|
||||||
|
|
||||||
/* return EXIT_FAILURE; - not reached */
|
/* return EXIT_FAILURE; - not reached */
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Never returns */
|
/* Never returns */
|
||||||
run_shell(opt_shell, flags & SU_OPT_l, (const char**)argv);
|
exec_shell(opt_shell, flags & SU_OPT_l, (const char**)argv);
|
||||||
|
|
||||||
/* return EXIT_FAILURE; - not reached */
|
/* return EXIT_FAILURE; - not reached */
|
||||||
}
|
}
|
||||||
|
@ -89,5 +89,5 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
shell = pwd->pw_shell;
|
shell = pwd->pw_shell;
|
||||||
|
|
||||||
/* Exec login shell with no additional parameters. Never returns. */
|
/* Exec login shell with no additional parameters. Never returns. */
|
||||||
run_shell(shell, 1, NULL);
|
exec_shell(shell, 1, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user