ash: read $HOME/.profile instead of $(pwd)/.profile

ash --login should read ~/.profile instead of .profile in the current
directory. I noticed it while trying to figure out why /root/.profile
is only read sometimes.

function                                             old     new   delta
ash_main                                            1374    1398     +24

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Stefan Hellermann
2013-03-15 02:45:50 +01:00
committed by Denys Vlasenko
parent aeb717aa5e
commit 4ef1439c59

View File

@ -13194,11 +13194,18 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
if (argv[0] && argv[0][0] == '-') if (argv[0] && argv[0][0] == '-')
isloginsh = 1; isloginsh = 1;
if (isloginsh) { if (isloginsh) {
const char *hp;
state = 1; state = 1;
read_profile("/etc/profile"); read_profile("/etc/profile");
state1: state1:
state = 2; state = 2;
read_profile(".profile"); hp = lookupvar("HOME");
if (hp) {
hp = concat_path_file(hp, ".profile");
read_profile(hp);
free((char*)hp);
}
} }
state2: state2:
state = 3; state = 3;