aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-05 08:23:13 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-05 08:23:13 +0000
commitfef07138b35e0cc1a174c65db0d19226cbbbe7eb (patch)
tree88813993baf9e82c65f69c83b85bf29668d982db /terminal.c
parentselection: document the asynchronous behavior of text_from_{primary,clipboard} (diff)
terminal: ptmx: ignore *both* EPOLLIN and EPOLLOUT on EPOLLHUP
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/terminal.c b/terminal.c
index e9368703..b7523d1b 100644
--- a/terminal.c
+++ b/terminal.c
@@ -117,15 +117,21 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data)
{
struct terminal *term = data;
- if (unlikely(events & EPOLLOUT)) {
+ bool pollin = events & EPOLLIN;
+ bool pollout = events & EPOLLOUT;
+ bool hup = events & EPOLLHUP;
+
+ if (hup) {
+ /* TODO: should we *not* ignore pollin? */
+ return term_shutdown(term);
+ }
+
+ if (pollout) {
if (!fdm_ptmx_out(fdm, fd, events, data))
return false;
}
- if (unlikely((events & EPOLLHUP) && !(events & EPOLLIN)))
- return term_shutdown(term);
-
- if (unlikely(!(events & EPOLLIN)))
+ if (!pollin)
return true;
uint8_t buf[24 * 1024];