mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-12 05:34:01 -04:00
terminal: ptmx: ignore *both* EPOLLIN and EPOLLOUT on EPOLLHUP
This commit is contained in:
parent
fd82caad42
commit
fef07138b3
1 changed files with 11 additions and 5 deletions
16
terminal.c
16
terminal.c
|
|
@ -117,15 +117,21 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data)
|
||||||
{
|
{
|
||||||
struct terminal *term = 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))
|
if (!fdm_ptmx_out(fdm, fd, events, data))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely((events & EPOLLHUP) && !(events & EPOLLIN)))
|
if (!pollin)
|
||||||
return term_shutdown(term);
|
|
||||||
|
|
||||||
if (unlikely(!(events & EPOLLIN)))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
uint8_t buf[24 * 1024];
|
uint8_t buf[24 * 1024];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue