summaryrefslogtreecommitdiff
path: root/shell/msh.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-02-09 17:30:14 +0000
committerDenis Vlasenko2007-02-09 17:30:14 +0000
commitd244c5eaf80677bc785ada68d4bb805cdf2d4505 (patch)
tree1323b11d2c573ee4aff9e2a0864ce6977bf0d060 /shell/msh.c
parentb477e18c1e4cf40f5463d24523a10870ece10888 (diff)
downloadbusybox-d244c5eaf80677bc785ada68d4bb805cdf2d4505.zip
busybox-d244c5eaf80677bc785ada68d4bb805cdf2d4505.tar.gz
msh: fix my buglet
Diffstat (limited to 'shell/msh.c')
-rw-r--r--shell/msh.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/shell/msh.c b/shell/msh.c
index a2da540..968f073 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -3157,12 +3157,15 @@ static int dochdir(struct op *t)
cp = t->words[1];
if (cp == NULL) {
cp = homedir->value;
- if (cp == NULL)
- er = ": no home directory";
- } else if (chdir(cp) < 0)
+ if (cp != NULL)
+ goto do_cd;
+ er = ": no home directory";
+ } else {
+ do_cd:
+ if (chdir(cp) >= 0)
+ return 0;
er = ": bad directory";
- else
- return 0;
+ }
prs(cp != NULL ? cp : "cd");
err(er);
return 1;