summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-05-08 10:18:19 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-05-08 10:18:19 +0100
commitc8ceb66ba3b0978762e52715f1f59918ae58e153 (patch)
tree9db92393d78bba571f936778826c3a4ee160f3fb /Src/Zle
parent942ac7e6e267fe409317fbdd0a26010a028812cb (diff)
downloadzsh-c8ceb66ba3b0978762e52715f1f59918ae58e153.tar.gz
zsh-c8ceb66ba3b0978762e52715f1f59918ae58e153.tar.xz
zsh-c8ceb66ba3b0978762e52715f1f59918ae58e153.zip
42751: Protect shell status in ZLE timed function handler.
Otherwise status from sched and other asynchronous functions
could escape back to the main shell.
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index be2b062b0..b78c47eed 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -631,6 +631,8 @@ raw_getbyte(long do_keytmout, char *cptr)
 		continue;
 	    }
 	    if (selret == 0) {
+		zlong save_lastval;
+
 		/*
 		 * Nothing ready and no error, so we timed out.
 		 */
@@ -648,6 +650,7 @@ raw_getbyte(long do_keytmout, char *cptr)
 		    break;
 
 		case ZTM_FUNC:
+		    save_lastval = lastval;
 		    while (firstnode(timedfns)) {
 			Timedfn tfdat = (Timedfn)getdata(firstnode(timedfns));
 			/*
@@ -661,6 +664,7 @@ raw_getbyte(long do_keytmout, char *cptr)
 			    break;
 			tfdat->func();
 		    }
+		    lastval = save_lastval;
 		    /* Function may have messed up the display */
 		    if (resetneeded)
 			zrefresh();