Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Fix for bin/7502, from Tor Egge / FreeBSD. Their com...



details:   https://anonhg.NetBSD.org/src/rev/f270c9b5de2c
branches:  trunk
changeset: 472497:f270c9b5de2c
user:      he <he%NetBSD.org@localhost>
date:      Fri Apr 30 17:54:17 1999 +0000

description:
Fix for bin/7502, from Tor Egge / FreeBSD.  Their commit message:
> During variable expansion, the internal representation of the expression
> might be relocated.  Handle this case.

diffstat:

 bin/sh/expand.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r 4dea29a33ca7 -r f270c9b5de2c bin/sh/expand.c
--- a/bin/sh/expand.c   Fri Apr 30 17:47:36 1999 +0000
+++ b/bin/sh/expand.c   Fri Apr 30 17:54:17 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expand.c,v 1.46 1999/04/06 21:05:27 he Exp $   */
+/*     $NetBSD: expand.c,v 1.47 1999/04/30 17:54:17 he Exp $   */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c   8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.46 1999/04/06 21:05:27 he Exp $");
+__RCSID("$NetBSD: expand.c,v 1.47 1999/04/30 17:54:17 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -622,7 +622,7 @@
        int varflags;
        char *var;
        char *val;
-       char *pat;
+       int patloc;
        int c;
        int set;
        int special;
@@ -720,10 +720,10 @@
                 * 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 */



Home | Main Index | Thread Index | Old Index