terminal: ptmx: ignore *both* EPOLLIN and EPOLLOUT on EPOLLHUP

This commit is contained in:
Daniel Eklöf 2019-11-05 09:23:13 +01:00
parent fd82caad42
commit fef07138b3
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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];