aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hellermann <stefan@the2masters.de>2013-03-03 15:29:32 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-03-15 02:37:51 +0100
commitaeb717aa5e8a5ae650a283306091a2872628cffd (patch)
tree60cf856dd17adff48b1a484d228b632763b65062
parent9e7c002182d2ce57ac23dc65dde23e5f1f6557f0 (diff)
downloadbusybox-w32-aeb717aa5e8a5ae650a283306091a2872628cffd.tar.gz
busybox-w32-aeb717aa5e8a5ae650a283306091a2872628cffd.tar.bz2
busybox-w32-aeb717aa5e8a5ae650a283306091a2872628cffd.zip
ash: move code to allow setting $HOME in /etc/profile
move HISTFILE=$HOME/.ash_history below reading /etc/profile, so that /etc/profile can set $HOME. HOME can be unset when directly invoking ash --login from init without going through getty. Signed-off-by: Stefan Hellermann <stefan@the2masters.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 0b5111a39..5f09fd474 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13191,19 +13191,6 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
13191 setstackmark(&smark); 13191 setstackmark(&smark);
13192 procargs(argv); 13192 procargs(argv);
13193 13193
13194#if ENABLE_FEATURE_EDITING_SAVEHISTORY
13195 if (iflag) {
13196 const char *hp = lookupvar("HISTFILE");
13197 if (!hp) {
13198 hp = lookupvar("HOME");
13199 if (hp) {
13200 char *defhp = concat_path_file(hp, ".ash_history");
13201 setvar("HISTFILE", defhp, 0);
13202 free(defhp);
13203 }
13204 }
13205 }
13206#endif
13207 if (argv[0] && argv[0][0] == '-') 13194 if (argv[0] && argv[0][0] == '-')
13208 isloginsh = 1; 13195 isloginsh = 1;
13209 if (isloginsh) { 13196 if (isloginsh) {
@@ -13243,6 +13230,15 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
13243#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY 13230#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
13244 if (iflag) { 13231 if (iflag) {
13245 const char *hp = lookupvar("HISTFILE"); 13232 const char *hp = lookupvar("HISTFILE");
13233 if (!hp) {
13234 hp = lookupvar("HOME");
13235 if(hp) {
13236 hp = concat_path_file(hp, ".ash_history");
13237 setvar("HISTFILE", hp, 0);
13238 free((char*)hp);
13239 hp = lookupvar("HISTFILE");
13240 }
13241 }
13246 if (hp) 13242 if (hp)
13247 line_input_state->hist_file = hp; 13243 line_input_state->hist_file = hp;
13248# if ENABLE_FEATURE_SH_HISTFILESIZE 13244# if ENABLE_FEATURE_SH_HISTFILESIZE