aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2015-11-06 20:46:23 +0100
committerChristoph Lohmann <20h@r-36.net>2015-11-06 20:46:23 +0100
commit00873e65eed161ee5f8916fbfb25c1a7f7a9b2f8 (patch)
treef03dc088eb8d028c2bc560caec9e6a5136781c4d
parent9f6d8845df3f81e2bc86f593a2f93e098422b2fa (diff)
downloadst-patched-00873e65eed161ee5f8916fbfb25c1a7f7a9b2f8.tar.bz2
st-patched-00873e65eed161ee5f8916fbfb25c1a7f7a9b2f8.tar.xz
st-patched-00873e65eed161ee5f8916fbfb25c1a7f7a9b2f8.zip
Introduce lim in all ttywrite() checks.
-rw-r--r--st.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/st.c b/st.c
index 900534b..a47f094 100644
--- a/st.c
+++ b/st.c
@@ -1522,11 +1522,11 @@ ttywrite(const char *s, size_t n)
1522 lim = ttyread(); 1522 lim = ttyread();
1523 if (FD_ISSET(cmdfd, &wfd)) { 1523 if (FD_ISSET(cmdfd, &wfd)) {
1524 /* 1524 /*
1525 * Only write 256 bytes at maximum. This seems to be a 1525 * Only write the bytes written by ttywrite() or the
1526 * reasonable value for a serial line. Bigger values 1526 * default of 256. This seems to be a reasonable value
1527 * might clog the I/O. 1527 * for a serial line. Bigger values might clog the I/O.
1528 */ 1528 */
1529 if ((r = write(cmdfd, s, (n < 256)? n : 256)) < 0) 1529 if ((r = write(cmdfd, s, (n < lim)? n : lim)) < 0)
1530 goto write_error; 1530 goto write_error;
1531 if (r < n) { 1531 if (r < n) {
1532 /* 1532 /*