summaryrefslogtreecommitdiff
path: root/bin/ksh/eval.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-12-13 16:37:07 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-12-13 16:37:07 +0000
commitdbc111483b41d97d8d1f754356fe33eb0ec20259 (patch)
tree927a320bb17a979807a4648edf436048acb25e40 /bin/ksh/eval.c
parent4e57de7bc09fb6c4ec2e5714ce9de0f1c1a6af42 (diff)
Restore sp before calling snptreef() so the error message contains
the actual expression that caused the error. OK otto@
Diffstat (limited to 'bin/ksh/eval.c')
-rw-r--r--bin/ksh/eval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c
index 9f2a5a51492..f8ebe29371b 100644
--- a/bin/ksh/eval.c
+++ b/bin/ksh/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.17 2004/12/09 11:32:07 otto Exp $ */
+/* $OpenBSD: eval.c,v 1.18 2004/12/13 16:37:06 millert Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -292,12 +292,12 @@ expand(cp, wp, f)
char endc;
char *str, *end;
+ sp = varname - 2; /* restore sp */
end = (char *) wdscan(sp, CSUBST);
/* ({) the } or x is already skipped */
endc = *end;
*end = EOS;
- str = snptreef((char *) 0, 64, "%S",
- varname - 1);
+ str = snptreef(NULL, 64, "%S", sp);
*end = endc;
errorf("%s: bad substitution", str);
}