use user's shell instead of hardwired "/bin/sh" (android needs this)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -20,8 +20,9 @@
|
||||
static void edit_file(const struct passwd *pas, const char *file)
|
||||
{
|
||||
const char *ptr;
|
||||
int pid = xvfork();
|
||||
pid_t pid;
|
||||
|
||||
pid = xvfork();
|
||||
if (pid) { /* parent */
|
||||
wait4pid(pid);
|
||||
return;
|
||||
@@ -30,7 +31,7 @@ static void edit_file(const struct passwd *pas, const char *file)
|
||||
/* CHILD - change user and run editor */
|
||||
/* initgroups, setgid, setuid */
|
||||
change_identity(pas);
|
||||
setup_environment(DEFAULT_SHELL,
|
||||
setup_environment(pas->pw_shell,
|
||||
SETUP_ENV_CHANGEENV | SETUP_ENV_TO_TMP,
|
||||
pas);
|
||||
ptr = getenv("VISUAL");
|
||||
@@ -41,7 +42,7 @@ static void edit_file(const struct passwd *pas, const char *file)
|
||||
}
|
||||
|
||||
BB_EXECLP(ptr, ptr, file, NULL);
|
||||
bb_perror_msg_and_die("exec %s", ptr);
|
||||
bb_perror_msg_and_die("can't execute '%s'", ptr);
|
||||
}
|
||||
|
||||
static int open_as_user(const struct passwd *pas, const char *file)
|
||||
|
Reference in New Issue
Block a user