msh: fix my buglet
This commit is contained in:
parent
b477e18c1e
commit
d244c5eaf8
13
shell/msh.c
13
shell/msh.c
@ -3157,12 +3157,15 @@ static int dochdir(struct op *t)
|
|||||||
cp = t->words[1];
|
cp = t->words[1];
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
cp = homedir->value;
|
cp = homedir->value;
|
||||||
if (cp == NULL)
|
if (cp != NULL)
|
||||||
er = ": no home directory";
|
goto do_cd;
|
||||||
} else if (chdir(cp) < 0)
|
er = ": no home directory";
|
||||||
|
} else {
|
||||||
|
do_cd:
|
||||||
|
if (chdir(cp) >= 0)
|
||||||
|
return 0;
|
||||||
er = ": bad directory";
|
er = ": bad directory";
|
||||||
else
|
}
|
||||||
return 0;
|
|
||||||
prs(cp != NULL ? cp : "cd");
|
prs(cp != NULL ? cp : "cd");
|
||||||
err(er);
|
err(er);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user