Prevent an O_NDELAY writer from blocking when a tty write is blocked by the tty atomi...
[powerpc.git] / drivers / char / n_tty.c
index b3d4ccc..371631f 100644 (file)
@@ -1191,6 +1191,7 @@ static int job_control(struct tty_struct *tty, struct file *file)
                            is_current_pgrp_orphaned())
                                return -EIO;
                        kill_pgrp(task_pgrp(current), SIGTTIN, 1);
+                       set_thread_flag(TIF_SIGPENDING);
                        return -ERESTARTSYS;
                }
        }
@@ -1537,7 +1538,8 @@ static unsigned int normal_poll(struct tty_struct * tty, struct file * file, pol
                else
                        tty->minimum_to_wake = 1;
        }
-       if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
+       if (!tty_is_writelocked(tty) &&
+                       tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
                        tty->driver->write_room(tty) > 0)
                mask |= POLLOUT | POLLWRNORM;
        return mask;