From df5115a741561d251b30926ce09486737da1e8da Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 28 Apr 2015 09:22:37 +0100 Subject: 34979: Preserve job text when doing shell job fix. This handles list_pipe_text in execlist() along with other variables that are saved and restored and, in the special case of source, cleared. --- Src/exec.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Src') diff --git a/Src/exec.c b/Src/exec.c index 60b79c6ea..31c80a74e 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1147,6 +1147,7 @@ execlist(Estate state, int dont_change_job, int exiting) wordcode code; int ret, cj, csp, ltype; int old_pline_level, old_list_pipe, old_list_pipe_job; + char *old_list_pipe_text; zlong oldlineno; /* * ERREXIT only forces the shell to exit if the last command in a && @@ -1160,10 +1161,16 @@ execlist(Estate state, int dont_change_job, int exiting) old_pline_level = pline_level; old_list_pipe = list_pipe; old_list_pipe_job = list_pipe_job; + if (*list_pipe_text) + old_list_pipe_text = ztrdup(list_pipe_text); + else + old_list_pipe_text = NULL; oldlineno = lineno; - if (sourcelevel && unset(SHINSTDIN)) + if (sourcelevel && unset(SHINSTDIN)) { pline_level = list_pipe = list_pipe_job = 0; + *list_pipe_text = '\0'; + } /* Loop over all sets of comands separated by newline, * * semi-colon or ampersand (`sublists'). */ @@ -1399,6 +1406,12 @@ sublist_done: pline_level = old_pline_level; list_pipe = old_list_pipe; list_pipe_job = old_list_pipe_job; + if (old_list_pipe_text) { + strcpy(list_pipe_text, old_list_pipe_text); + zsfree(old_list_pipe_text); + } else { + *list_pipe_text = '\0'; + } lineno = oldlineno; if (dont_change_job) thisjob = cj; -- cgit 1.4.1