summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hellermann <stefan@the2masters.de>2013-03-15 01:45:50 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2013-03-15 01:45:50 (GMT)
commit4ef1439c593daadeffb3f00eaaf49e190a3039e1 (patch)
tree1e2798e8de90e64e90fae17768974010d0e8da9a
parentaeb717aa5e8a5ae650a283306091a2872628cffd (diff)
downloadbusybox-4ef1439c593daadeffb3f00eaaf49e190a3039e1.tar.gz
busybox-4ef1439c593daadeffb3f00eaaf49e190a3039e1.tar.bz2
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>
-rw-r--r--shell/ash.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 5f09fd4..fbbdb06 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13194,11 +13194,18 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
if (argv[0] && argv[0][0] == '-')
isloginsh = 1;
if (isloginsh) {
+ const char *hp;
+
state = 1;
read_profile("/etc/profile");
state1:
state = 2;
- read_profile(".profile");
+ hp = lookupvar("HOME");
+ if (hp) {
+ hp = concat_path_file(hp, ".profile");
+ read_profile(hp);
+ free((char*)hp);
+ }
}
state2:
state = 3;
@@ -13232,7 +13239,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
const char *hp = lookupvar("HISTFILE");
if (!hp) {
hp = lookupvar("HOME");
- if(hp) {
+ if (hp) {
hp = concat_path_file(hp, ".ash_history");
setvar("HISTFILE", hp, 0);
free((char*)hp);