st

simple terminal

git clone https://9o.is/git/st.git

commit d9083cb9328f5421301d55ae10397c05e4ab08ff
parent 952ff52fe369f7bbc55a668fec4619033caf5731
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 21 Nov 2015 18:21:03 +0100

Avoid recursive call to ttywrite from ttyread

Ttyread() calls to ttywrite, so if we check for reading before
that for writing in ttywrite we can get a circular call sequence.

Diffstat:
Mst.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/st.c b/st.c @@ -1518,8 +1518,6 @@ ttywrite(const char *s, size_t n) continue; die("select failed: %s\n", strerror(errno)); } - if (FD_ISSET(cmdfd, &rfd)) - lim = ttyread(); if (FD_ISSET(cmdfd, &wfd)) { /* * Only write the bytes written by ttywrite() or the @@ -1543,6 +1541,8 @@ ttywrite(const char *s, size_t n) break; } } + if (FD_ISSET(cmdfd, &rfd)) + lim = ttyread(); } return;