1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-12-11 07:21:45 +01:00

31832: make execrestore() more signal-safe.

This commit is contained in:
Bart Schaefer 2013-10-17 07:35:05 -07:00
parent ff520d1b79
commit 978b5bcc8d
2 changed files with 29 additions and 23 deletions

View file

@ -4,6 +4,8 @@
HISTORY_IGNORE pattern to exclude matching lines in the HISTORY_IGNORE pattern to exclude matching lines in the
internal history from the HISTFILE at write time. internal history from the HISTFILE at write time.
* 31832: Src/exec.c: make execrestore() more signal-safe.
2013-10-17 Peter Stephenson <p.stephenson@samsung.com> 2013-10-17 Peter Stephenson <p.stephenson@samsung.com>
* 31830: Doc/Zsh/func.yo, README, Src/hist.c, Src/zsh.h: * 31830: Doc/Zsh/func.yo, README, Src/hist.c, Src/zsh.h:

View file

@ -5078,29 +5078,33 @@ execsave(void)
void void
execrestore(void) execrestore(void)
{ {
struct execstack *en; struct execstack *en = exstack;
DPUTS(!exstack, "BUG: execrestore() without execsave()"); DPUTS(!exstack, "BUG: execrestore() without execsave()");
list_pipe_pid = exstack->list_pipe_pid;
nowait = exstack->nowait; queue_signals();
pline_level = exstack->pline_level; exstack = exstack->next;
list_pipe_child = exstack->list_pipe_child;
list_pipe_job = exstack->list_pipe_job; list_pipe_pid = en->list_pipe_pid;
strcpy(list_pipe_text, exstack->list_pipe_text); nowait = en->nowait;
lastval = exstack->lastval; pline_level = en->pline_level;
noeval = exstack->noeval; list_pipe_child = en->list_pipe_child;
badcshglob = exstack->badcshglob; list_pipe_job = en->list_pipe_job;
cmdoutpid = exstack->cmdoutpid; strcpy(list_pipe_text, en->list_pipe_text);
cmdoutval = exstack->cmdoutval; lastval = en->lastval;
use_cmdoutval = exstack->use_cmdoutval; noeval = en->noeval;
trap_return = exstack->trap_return; badcshglob = en->badcshglob;
trap_state = exstack->trap_state; cmdoutpid = en->cmdoutpid;
trapisfunc = exstack->trapisfunc; cmdoutval = en->cmdoutval;
traplocallevel = exstack->traplocallevel; use_cmdoutval = en->use_cmdoutval;
noerrs = exstack->noerrs; trap_return = en->trap_return;
setunderscore(exstack->underscore); trap_state = en->trap_state;
zsfree(exstack->underscore); trapisfunc = en->trapisfunc;
en = exstack->next; traplocallevel = en->traplocallevel;
free(exstack); noerrs = en->noerrs;
exstack = en; setunderscore(en->underscore);
zsfree(en->underscore);
free(en);
unqueue_signals();
} }