Source-Changes-HG archive

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

[src/trunk]: src/bin/sh A similar fix to that added in 1.169 of eval.c, but h...



details:   https://anonhg.NetBSD.org/src/rev/bff9ad5bf182
branches:  trunk
changeset: 447390:bff9ad5bf182
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Jan 09 10:59:20 2019 +0000

description:
A similar fix to that added in 1.169 of eval.c, but here for when
processing command substitutions.   If there is an error while processing,
the any pending queued input should be discarded.   From FreeBSD.

diffstat:

 bin/sh/parser.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r bb4c30eb6054 -r bff9ad5bf182 bin/sh/parser.c
--- a/bin/sh/parser.c   Wed Jan 09 10:57:43 2019 +0000
+++ b/bin/sh/parser.c   Wed Jan 09 10:59:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parser.c,v 1.159 2018/12/11 13:31:20 kre Exp $ */
+/*     $NetBSD: parser.c,v 1.160 2019/01/09 10:59:20 kre Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c   8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.159 2018/12/11 13:31:20 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.160 2019/01/09 10:59:20 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -1347,11 +1347,13 @@
        char *volatile sstr = str;
        struct jmploc jmploc;
        struct jmploc *const savehandler = handler;
+       struct parsefile *const savetopfile = getcurrentfile();
        const int savelen = in - stackblock();
        int saveprompt;
        int lno;
 
        if (setjmp(jmploc.loc)) {
+               popfilesupto(savetopfile);
                if (sstr)
                        ckfree(__UNVOLATILE(sstr));
                cleanup_state_stack(stack);



Home | Main Index | Thread Index | Old Index