|
@@ -2413,12 +2413,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file,
|
|
|
|
|
|
poll_wait(file, &tty->read_wait, wait);
|
|
|
poll_wait(file, &tty->write_wait, wait);
|
|
|
+ if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
|
|
|
+ mask |= POLLHUP;
|
|
|
if (input_available_p(tty, 1))
|
|
|
mask |= POLLIN | POLLRDNORM;
|
|
|
+ else if (mask & POLLHUP) {
|
|
|
+ tty_flush_to_ldisc(tty);
|
|
|
+ if (input_available_p(tty, 1))
|
|
|
+ mask |= POLLIN | POLLRDNORM;
|
|
|
+ }
|
|
|
if (tty->packet && tty->link->ctrl_status)
|
|
|
mask |= POLLPRI | POLLIN | POLLRDNORM;
|
|
|
- if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
|
|
|
- mask |= POLLHUP;
|
|
|
if (tty_hung_up_p(file))
|
|
|
mask |= POLLHUP;
|
|
|
if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) {
|