summaryrefslogtreecommitdiffstats
path: root/bin/sh/input.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-06-17 21:58:32 +0000
committerjilles <jilles@FreeBSD.org>2009-06-17 21:58:32 +0000
commit8f12a6bcc5ea67ea87483b297472861ac8058429 (patch)
treeeddfb4b7b3306a37d19b0ab7ad5c4163bc7ba994 /bin/sh/input.c
parent31dc96eed07dbbddab558676889b03a59ba38b4c (diff)
downloadFreeBSD-src-8f12a6bcc5ea67ea87483b297472861ac8058429.zip
FreeBSD-src-8f12a6bcc5ea67ea87483b297472861ac8058429.tar.gz
Properly flush input after an error in backquotes in interactive mode.
For parsing an old-style backquote substitution (`...`), a string "file" is used to store the contents of the substitution (with the special backslash processing done). If an error occurs, the shell cleans up all these files (returning to the top level) and flush the top level file. Erroneously, it first flushed the current file and then cleaned up all extra files, so that the top level file (i.e. the terminal) was not flushed. Example (in interactive mode): echo `for` echo This should not be printed Also noticeable in (in interactive mode): echo `(` The old version prints an extraneous prompt. Approved by: ed (mentor)
Diffstat (limited to 'bin/sh/input.c')
-rw-r--r--bin/sh/input.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/input.c b/bin/sh/input.c
index c97c496..f709b8c 100644
--- a/bin/sh/input.c
+++ b/bin/sh/input.c
@@ -118,9 +118,9 @@ INIT {
}
RESET {
+ popallfiles();
if (exception != EXSHELLPROC)
parselleft = parsenleft = 0; /* clear input buffer */
- popallfiles();
}
SHELLPROC {
OpenPOWER on IntegriCloud