aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-12-02 21:28:47 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-02 21:28:47 +0100
commit2075aa93e007863c6b680994a7a0ba420181034f (patch)
tree1e9a01215018359e4a8524a9a044d7a61fae1967 /libbb
parentb4f93f562d261a163113cd15cc252c53d2fa27bb (diff)
downloadbusybox-w32-2075aa93e007863c6b680994a7a0ba420181034f.tar.gz
busybox-w32-2075aa93e007863c6b680994a7a0ba420181034f.tar.bz2
busybox-w32-2075aa93e007863c6b680994a7a0ba420181034f.zip
libbb: rename run_shell() to exec_shell()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/executable.c9
-rw-r--r--libbb/run_shell.c13
2 files changed, 11 insertions, 11 deletions
diff --git a/libbb/executable.c b/libbb/executable.c
index 29d2a2c85..a033b74d9 100644
--- a/libbb/executable.c
+++ b/libbb/executable.c
@@ -91,12 +91,3 @@ void FAST_FUNC BB_EXECVP_or_die(char **argv)
91 xfunc_error_retval = (errno == ENOENT) ? 127 : 126; 91 xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
92 bb_perror_msg_and_die("can't execute '%s'", argv[0]); 92 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
93} 93}
94
95/* Typical idiom for applets which exec *optional* PROG [ARGS] */
96void FAST_FUNC exec_prog_or_SHELL(char **argv)
97{
98 if (argv[0]) {
99 BB_EXECVP_or_die(argv);
100 }
101 run_shell(getenv("SHELL"), /*login:*/ 1, NULL);
102}
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index a0420d982..c2ff69651 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -48,10 +48,10 @@ void FAST_FUNC set_current_security_context(security_context_t sid)
48 48
49#endif 49#endif
50 50
51/* Run SHELL, or DEFAULT_SHELL if SHELL is "" or NULL. 51/* Exec SHELL, or DEFAULT_SHELL if SHELL is "" or NULL.
52 * If ADDITIONAL_ARGS is not NULL, pass them to the shell. 52 * If ADDITIONAL_ARGS is not NULL, pass them to the shell.
53 */ 53 */
54void FAST_FUNC run_shell(const char *shell, int loginshell, const char **additional_args) 54void FAST_FUNC exec_shell(const char *shell, int loginshell, const char **additional_args)
55{ 55{
56 const char **args; 56 const char **args;
57 57
@@ -84,3 +84,12 @@ void FAST_FUNC run_shell(const char *shell, int loginshell, const char **additio
84 execv(shell, (char **) args); 84 execv(shell, (char **) args);
85 bb_perror_msg_and_die("can't execute '%s'", shell); 85 bb_perror_msg_and_die("can't execute '%s'", shell);
86} 86}
87
88/* Typical idiom for applets which exec *optional* PROG [ARGS] */
89void FAST_FUNC exec_prog_or_SHELL(char **argv)
90{
91 if (argv[0]) {
92 BB_EXECVP_or_die(argv);
93 }
94 exec_shell(getenv("SHELL"), /*login:*/ 1, NULL);
95}