diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-02 21:28:47 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-02 21:28:47 +0100 |
commit | 2075aa93e007863c6b680994a7a0ba420181034f (patch) | |
tree | 1e9a01215018359e4a8524a9a044d7a61fae1967 | |
parent | b4f93f562d261a163113cd15cc252c53d2fa27bb (diff) | |
download | busybox-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>
-rw-r--r-- | include/libbb.h | 4 | ||||
-rw-r--r-- | libbb/executable.c | 9 | ||||
-rw-r--r-- | libbb/run_shell.c | 13 | ||||
-rw-r--r-- | loginutils/login.c | 2 | ||||
-rw-r--r-- | loginutils/su.c | 2 | ||||
-rw-r--r-- | loginutils/sulogin.c | 2 |
6 files changed, 16 insertions, 16 deletions
diff --git a/include/libbb.h b/include/libbb.h index 9872dc1fb..c23018f17 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1140,7 +1140,6 @@ int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC; | |||
1140 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__) | 1140 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__) |
1141 | #endif | 1141 | #endif |
1142 | void BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; | 1142 | void BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; |
1143 | void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC; | ||
1144 | 1143 | ||
1145 | /* xvfork() can't be a _function_, return after vfork in child mangles stack | 1144 | /* xvfork() can't be a _function_, return after vfork in child mangles stack |
1146 | * in the parent. It must be a macro. */ | 1145 | * in the parent. It must be a macro. */ |
@@ -1607,7 +1606,8 @@ void bb_do_delay(unsigned seconds) FAST_FUNC; | |||
1607 | void msleep(unsigned ms) FAST_FUNC; | 1606 | void msleep(unsigned ms) FAST_FUNC; |
1608 | void sleep1(void) FAST_FUNC; | 1607 | void sleep1(void) FAST_FUNC; |
1609 | void change_identity(const struct passwd *pw) FAST_FUNC; | 1608 | void change_identity(const struct passwd *pw) FAST_FUNC; |
1610 | void run_shell(const char *shell, int loginshell, const char **args) NORETURN FAST_FUNC; | 1609 | void exec_shell(const char *shell, int loginshell, const char **args) NORETURN FAST_FUNC; |
1610 | void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC; | ||
1611 | 1611 | ||
1612 | /* Returns $SHELL, getpwuid(getuid())->pw_shell, or DEFAULT_SHELL. | 1612 | /* Returns $SHELL, getpwuid(getuid())->pw_shell, or DEFAULT_SHELL. |
1613 | * Note that getpwuid result might need xstrdup'ing | 1613 | * Note that getpwuid result might need xstrdup'ing |
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] */ | ||
96 | void 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 | */ |
54 | void FAST_FUNC run_shell(const char *shell, int loginshell, const char **additional_args) | 54 | void 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] */ | ||
89 | void 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 | } | ||
diff --git a/loginutils/login.c b/loginutils/login.c index f0bce50ce..aacd47241 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
@@ -602,7 +602,7 @@ int login_main(int argc UNUSED_PARAM, char **argv) | |||
602 | signal(SIGINT, SIG_DFL); | 602 | signal(SIGINT, SIG_DFL); |
603 | 603 | ||
604 | /* Exec login shell with no additional parameters */ | 604 | /* Exec login shell with no additional parameters */ |
605 | run_shell(pw->pw_shell, 1, NULL); | 605 | exec_shell(pw->pw_shell, 1, NULL); |
606 | 606 | ||
607 | /* return EXIT_FAILURE; - not reached */ | 607 | /* return EXIT_FAILURE; - not reached */ |
608 | } | 608 | } |
diff --git a/loginutils/su.c b/loginutils/su.c index 6f91039f9..784a53552 100644 --- a/loginutils/su.c +++ b/loginutils/su.c | |||
@@ -204,7 +204,7 @@ int su_main(int argc UNUSED_PARAM, char **argv) | |||
204 | */ | 204 | */ |
205 | 205 | ||
206 | /* Never returns */ | 206 | /* Never returns */ |
207 | run_shell(opt_shell, flags & SU_OPT_l, (const char**)argv); | 207 | exec_shell(opt_shell, flags & SU_OPT_l, (const char**)argv); |
208 | 208 | ||
209 | /* return EXIT_FAILURE; - not reached */ | 209 | /* return EXIT_FAILURE; - not reached */ |
210 | } | 210 | } |
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 48dafd186..127aa1de9 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c | |||
@@ -89,5 +89,5 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv) | |||
89 | shell = pwd->pw_shell; | 89 | shell = pwd->pw_shell; |
90 | 90 | ||
91 | /* Exec login shell with no additional parameters. Never returns. */ | 91 | /* Exec login shell with no additional parameters. Never returns. */ |
92 | run_shell(shell, 1, NULL); | 92 | exec_shell(shell, 1, NULL); |
93 | } | 93 | } |