From c4e5a8a8b9298fab6d2fb0240f69c86302a12943 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Tue, 13 Apr 1999 04:13:09 +0000 Subject: [PATCH] During variable expansion, the internal representation of the expression might be relocated. Handle this case. PR: 7059 --- bin/sh/expand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 8a6f03a0a77a..074b32ac748d 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; #endif static const char rcsid[] = - "$Id: expand.c,v 1.24 1998/09/13 19:24:57 tegge Exp $"; + "$Id: expand.c,v 1.25 1999/04/09 15:23:48 tegge Exp $"; #endif /* not lint */ #include @@ -646,7 +646,7 @@ evalvar(p, flag) int varflags; char *var; char *val; - char *pat; + int patloc; int c; int set; int special; @@ -744,10 +744,10 @@ evalvar(p, flag) * right after it */ STPUTC('\0', expdest); - pat = expdest; - if (subevalvar(p, NULL, expdest - stackblock(), subtype, + patloc = expdest - stackblock(); + if (subevalvar(p, NULL, patloc, subtype, startloc, varflags) == 0) { - int amount = (expdest - pat) + 1; + int amount = (expdest - stackblock() - patloc) + 1; STADJUST(-amount, expdest); } /* Remove any recorded regions beyond start of variable */