From c8ceb66ba3b0978762e52715f1f59918ae58e153 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Tue, 8 May 2018 10:18:19 +0100
Subject: 42751: Protect shell status in ZLE timed function handler.
Otherwise status from sched and other asynchronous functions
could escape back to the main shell.
---
ChangeLog | 5 +++++
Src/Zle/zle_main.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 18cdabe01..7449386e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-08 Peter Stephenson
+
+ * 42751: Src/Zle/zle_main.c: Protect shell status around
+ time function execution in line editor.
+
2018-05-02 Oliver Kiddle
* Eitan Adler: 42740: Completion/BSD/Command/_systat:
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();
--
cgit 1.4.1