commit 375b28720f7c78e6fac1c274f9dee7c40a78aacb from: Roberto E. Vargas Caballero date: Sat Nov 21 17:21:03 2015 UTC 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. commit - d836561b96097b04760104e7e0f8d014f5889a18 commit + 375b28720f7c78e6fac1c274f9dee7c40a78aacb blob - a47f0942a8792d900295d6d7ff277c46b2029696 blob + c5d62c1599dc55fd27e235fc30bd06a165fa912e --- st.c +++ 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;