su: do not change to home dir unless -l

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Pascal Bellard 2012-06-12 13:21:02 +02:00 committed by Denys Vlasenko
parent 588e284f53
commit 70fc8c17e2
5 changed files with 11 additions and 7 deletions

View file

@ -355,13 +355,13 @@ void FAST_FUNC xsetuid(uid_t uid)
void FAST_FUNC xchdir(const char *path)
{
if (chdir(path))
bb_perror_msg_and_die("chdir(%s)", path);
bb_perror_msg_and_die("can't change directory to '%s'", path);
}
void FAST_FUNC xchroot(const char *path)
{
if (chroot(path))
bb_perror_msg_and_die("can't change root directory to %s", path);
bb_perror_msg_and_die("can't change root directory to '%s'", path);
xchdir("/");
}