aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/expand.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r--bin/sh/expand.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index 6316400c88d5..922bf5c3c4e8 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -623,10 +623,11 @@ static const char *
subevalvar_misc(const char *p, struct nodelist **restrict argbackq,
const char *var, int subtype, int startloc, int varflags)
{
+ const char *end;
char *startp;
int amount;
- p = argstr(p, argbackq, EXP_TILDE, NULL);
+ end = argstr(p, argbackq, EXP_TILDE, NULL);
STACKSTRNUL(expdest);
startp = stackblock() + startloc;
@@ -635,7 +636,7 @@ subevalvar_misc(const char *p, struct nodelist **restrict argbackq,
setvar(var, startp, 0);
amount = startp - expdest;
STADJUST(amount, expdest);
- return p;
+ return end;
case VSQUESTION:
if (*p != CTLENDVAR) {