aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2017-06-06 14:53:28 +0000
committernicm <nicm>2017-06-06 14:53:28 +0000
commitd7280917da5bfdf1811772c5f44fe1dd341c1742 (patch)
tree8fd5167fa0c9ec721cda6040d60209738fbe25bc /tty.c
parent2f04108f3a35271ef60b3028699b6363e1714140 (diff)
downloadrtmux-d7280917da5bfdf1811772c5f44fe1dd341c1742.tar.gz
rtmux-d7280917da5bfdf1811772c5f44fe1dd341c1742.tar.bz2
rtmux-d7280917da5bfdf1811772c5f44fe1dd341c1742.zip
Delete input event when evbuffer_read() fails to avoid just spinning
around a dead file descriptor. Seems to fix a problem reported by Greg Hurrell in GitHub issue 941.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tty.c b/tty.c
index 3d0e210b..77291daa 100644
--- a/tty.c
+++ b/tty.c
@@ -159,8 +159,10 @@ tty_read_callback(__unused int fd, __unused short events, void *data)
int nread;
nread = evbuffer_read(tty->in, tty->fd, -1);
- if (nread == -1)
+ if (nread == -1) {
+ event_del(&tty->event_in);
return;
+ }
log_debug("%s: read %d bytes (already %zu)", c->name, nread, size);
while (tty_keys_next(tty))