aboutsummaryrefslogtreecommitdiff
path: root/bin/sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/builtins2
-rw-r--r--bin/sh/cd.c2
-rw-r--r--bin/sh/expand.c8
-rw-r--r--bin/sh/miscbltin.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/bin/sh/builtins b/bin/sh/builtins
index b605bd890533..a08020a82430 100644
--- a/bin/sh/builtins
+++ b/bin/sh/builtins
@@ -50,7 +50,7 @@
# This file is part of ash, which is distributed under the terms specified
# by the Ash General Public License. See the file named LICENSE.
-bltincmd command
+bltincmd bltin
#alloccmd alloc
bgcmd -j bg
breakcmd break continue
diff --git a/bin/sh/cd.c b/bin/sh/cd.c
index e458c1f0ae20..615ac7a38fd2 100644
--- a/bin/sh/cd.c
+++ b/bin/sh/cd.c
@@ -217,7 +217,7 @@ top:
STPUTC('\0', p);
p = grabstackstr(p);
INTOFF;
- if (chdir(p) < 0) {
+ if (chdir(*p ? p : ".") < 0) {
INTON;
return -1;
}
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index 95d2e504cd70..c350eae3ee7f 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -403,7 +403,7 @@ again: /* jump here after setting a variable with ${var=text} */
if ((c = *p++) == CTLESC)
p++;
else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) {
- if (set)
+ if (set && argbackq)
argbackq = argbackq->next;
} else if (c == CTLVAR) {
if ((*p++ & VSTYPE) != VSNORMAL)
@@ -664,10 +664,10 @@ expandmeta(str)
savelastp = exparg.lastp;
INTOFF;
if (expdir == NULL)
- expdir = ckmalloc(8192); /* I hope this is big enough */
+ expdir = ckmalloc(16384); /* I hope this is big enough */
expmeta(expdir, str->text);
- if(strlen(expdir) >= 8192)
- error("malloc overflow in sh:expand.c in ckmalloc(8192)\n");
+ if(strlen(expdir) >= 16384)
+ error("malloc overflow in sh:expand.c in ckmalloc(16384)\n");
ckfree(expdir);
expdir = NULL;
INTON;
diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
index b14da674a166..3384cd5c8341 100644
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -89,8 +89,8 @@ readcmd(argc, argv) char **argv; {
out2str(prompt);
flushall();
}
- if ((ap = argptr) == NULL)
- error("arg count");
+ if (*(ap = argptr) == NULL)
+ error("bad argument/arg count");
if ((ifs = bltinlookup("IFS", 1)) == NULL)
ifs = nullstr;
status = 0;