diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-15 15:53:53 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-15 16:02:34 +0000 |
commit | f9b753e70101ddd708841cc942e2072e1163a260 (patch) | |
tree | 229d9fb519c60f635e8d5a6fac08ca85cf6fbb8a /shell | |
parent | 996f93243dda87de3140c497624312722f47ffa1 (diff) | |
download | busybox-w32-f9b753e70101ddd708841cc942e2072e1163a260.tar.gz busybox-w32-f9b753e70101ddd708841cc942e2072e1163a260.tar.bz2 busybox-w32-f9b753e70101ddd708841cc942e2072e1163a260.zip |
ash: set current working directory on startup
When the shell starts behave as though the user had manually changed
to the current working directory of the process, but only if it's an
interactive, non-login shell and the '-d' flag isn't present.
This gives more consistent behaviour when the shell is started in a
drive mapped to a network share or a symlinked directory.
This completes the changes requested in GitHub issue #148.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index 4adad65aa..40cb9bce8 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -15009,6 +15009,13 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
15009 | chdir(dirarg); | 15009 | chdir(dirarg); |
15010 | setpwd(NULL, 0); | 15010 | setpwd(NULL, 0); |
15011 | } | 15011 | } |
15012 | else if (!login_sh && iflag) { | ||
15013 | char *cwd = getcwd(NULL, 0); | ||
15014 | if (cwd) { | ||
15015 | docd(cwd, 0); | ||
15016 | free(cwd); | ||
15017 | } | ||
15018 | } | ||
15012 | 15019 | ||
15013 | if (title) | 15020 | if (title) |
15014 | set_title(title); | 15021 | set_title(title); |