diff options
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r-- | drivers/tty/n_tty.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 89c4cee253e3..2e900a98c3e3 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -2413,12 +2413,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, | |||
2413 | 2413 | ||
2414 | poll_wait(file, &tty->read_wait, wait); | 2414 | poll_wait(file, &tty->read_wait, wait); |
2415 | poll_wait(file, &tty->write_wait, wait); | 2415 | poll_wait(file, &tty->write_wait, wait); |
2416 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2417 | mask |= POLLHUP; | ||
2416 | if (input_available_p(tty, 1)) | 2418 | if (input_available_p(tty, 1)) |
2417 | mask |= POLLIN | POLLRDNORM; | 2419 | mask |= POLLIN | POLLRDNORM; |
2420 | else if (mask & POLLHUP) { | ||
2421 | tty_flush_to_ldisc(tty); | ||
2422 | if (input_available_p(tty, 1)) | ||
2423 | mask |= POLLIN | POLLRDNORM; | ||
2424 | } | ||
2418 | if (tty->packet && tty->link->ctrl_status) | 2425 | if (tty->packet && tty->link->ctrl_status) |
2419 | mask |= POLLPRI | POLLIN | POLLRDNORM; | 2426 | mask |= POLLPRI | POLLIN | POLLRDNORM; |
2420 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2421 | mask |= POLLHUP; | ||
2422 | if (tty_hung_up_p(file)) | 2427 | if (tty_hung_up_p(file)) |
2423 | mask |= POLLHUP; | 2428 | mask |= POLLHUP; |
2424 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { | 2429 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { |