summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-06-06 14:53:28 +0000
committernicm <nicm@openbsd.org>2017-06-06 14:53:28 +0000
commit7f59910c2db7a0ec02562ac6cba593ee35f3f32b (patch)
tree1c99183eba0dab08d76529611c3cfe309601c1fe
parentRemove code that is not needed right now. (diff)
downloadwireguard-openbsd-7f59910c2db7a0ec02562ac6cba593ee35f3f32b.tar.xz
wireguard-openbsd-7f59910c2db7a0ec02562ac6cba593ee35f3f32b.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.
-rw-r--r--usr.bin/tmux/tty.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index a2b901c97b3..cfb811cf0fc 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.289 2017/06/04 08:02:20 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.290 2017/06/06 14:53:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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))