about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-11-25 22:14:50 +0100
committerOliver Kiddle <opk@zsh.org>2014-11-25 22:14:50 +0100
commitfeda07c641b865c8913e3fc34f28ad88f2d6da7e (patch)
tree1c76c60eac7d27379c2ffd5fe7f52cab2dac30a9
parentee38545c623992d968c0729479663f79c816af2e (diff)
downloadzsh-feda07c641b865c8913e3fc34f28ad88f2d6da7e.tar.gz
zsh-feda07c641b865c8913e3fc34f28ad88f2d6da7e.tar.xz
zsh-feda07c641b865c8913e3fc34f28ad88f2d6da7e.zip
33770: avoid calling identical FIONREAD ioctl twice in succession
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_main.c14
2 files changed, 8 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a021339d..08f53b631 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-11-25  Oliver Kiddle  <opk@zsh.org>
 
+	* 33770: Src/Zle/zle_main.c: avoid calling identical FIONREAD
+	ioctl twice in succession
+
 	* users/19365 (credit Death Jester and Jan Larres):
 	Completion/Base/Completer/_external_pwds;
 	completer for current directory of other shell processes
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index d157e36c2..a38f55bfe 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -238,9 +238,9 @@ zsetterm(void)
 	 * we can't set up the terminal for zle *at all* until
 	 * we are sure there is no more typeahead to come.  So
 	 * if there is typeahead, we set the flag delayzsetterm.
-	 * Then getbyte() performs another FIONREAD call; if that is
-	 * 0, we have finally used up all the typeahead, and it is
-	 * safe to alter the terminal, which we do at that point.
+	 * Then getbyte() calls here to performs another FIONREAD call;
+	 * if that is 0, we have finally used up all the typeahead, and
+	 * it is safe to alter the terminal, which we do at that point.
 	 */
 	delayzsetterm = 1;
 	return;
@@ -884,12 +884,8 @@ getbyte(long do_keytmout, int *timeout)
 	ret = STOUC(kungetbuf[--kungetct]);
     else {
 #ifdef FIONREAD
-	if (delayzsetterm) {
-	    int val;
-	    ioctl(SHTTY, FIONREAD, (char *)&val);
-	    if (!val)
-		zsetterm();
-	}
+	if (delayzsetterm)
+	    zsetterm();
 #endif
 	for (;;) {
 	    int q = queue_signal_level();