Skip to content

Commit

Permalink
Fix bug that would lose data near end of input pipe,
Browse files Browse the repository at this point in the history
when poll() returns both POLLIN and POLLHUP.
  • Loading branch information
gwsw committed Nov 18, 2022
1 parent 02f62a5 commit 088439e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion os.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ iread(fd, buf, len)
}
}
int fd_events = poll_events(fd, POLLIN|POLLHUP|POLLERR);
if (fd_events & close_events)
if ((fd_events & close_events) && !(fd_events & POLLIN))
{
sigs |= S_INTERRUPT;
reading = 0;
Expand Down

0 comments on commit 088439e

Please sign in to comment.