Module Name:    src
Committed By:   kre
Date:           Wed Jan  9 10:59:21 UTC 2019

Modified Files:
        src/bin/sh: parser.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.159 src/bin/sh/parser.c:1.160
--- src/bin/sh/parser.c:1.159	Tue Dec 11 13:31:20 2018
+++ src/bin/sh/parser.c	Wed Jan  9 10:59:20 2019
@@ -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 @@ parsebackq(VSS *const stack, char * cons
 	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);

Reply via email to