← Commit list

f4f6e5144

Denys Vlasenko
Denys Vlasenko
2020-12-02
SUCCESS Duration: 152s

Subject

libbb: exec_login_shell() - new function

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

include/libbb.h+1 -0
@@ -1607,6 +1607,7 @@ void msleep(unsigned ms) FAST_FUNC;
void sleep1(void) FAST_FUNC;
void change_identity(const struct passwd *pw) FAST_FUNC;
void exec_shell(const char *shell, int loginshell, const char **args) NORETURN FAST_FUNC;
+void exec_login_shell(const char *shell) NORETURN FAST_FUNC;
void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
/* Returns $SHELL, getpwuid(getuid())->pw_shell, or DEFAULT_SHELL.
libbb/run_shell.c+7 -2
@@ -84,14 +84,19 @@ void FAST_FUNC exec_shell(const char *shell, int loginshell, const char **additi
bb_perror_msg_and_die("can't execute '%s'", shell);
}
+void FAST_FUNC exec_login_shell(const char *shell)
+{
+ exec_shell(shell, 1, NULL);
+}
+
/* 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);
}
- /* Why login=1? Both users (nsenter and unshare) do indeed exec
+ /* Both users (nsenter and unshare) do indeed exec
* a _login_ shell (with dash in argv[0])!
*/
- exec_shell(getenv("SHELL"), /*login:*/ 1, NULL);
+ exec_login_shell(getenv("SHELL"));
}
loginutils/login.c+1 -1
@@ -602,7 +602,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
signal(SIGINT, SIG_DFL);
/* Exec login shell with no additional parameters */
- exec_shell(pw->pw_shell, 1, NULL);
+ exec_login_shell(pw->pw_shell);
/* return EXIT_FAILURE; - not reached */
}
loginutils/sulogin.c+1 -1
@@ -89,5 +89,5 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
shell = pwd->pw_shell;
/* Exec login shell with no additional parameters. Never returns. */
- exec_shell(shell, 1, NULL);
+ exec_login_shell(shell);
}