From 7f59910c2db7a0ec02562ac6cba593ee35f3f32b Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 6 Jun 2017 14:53:28 +0000 Subject: [PATCH] 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. --- usr.bin/tmux/tty.c | 6 ++++-- 1 file 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 @@ -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)) -- 2.20.1