Messages in this thread Patch in this message |  | | | From | OGAWA Hirofumi <> | | Subject | Re: [PATCH] kdesu broken | | Date | Tue, 28 Jul 2009 00:04:42 +0900 |
| |
Alan Cox <alan@lxorguk.ukuu.org.uk> writes:
>> > + set_bit(TTY_EOFPENDING, &pair->flags); >> > + set_bit(TTY_OTHER_CLOSED, &pair->flags); >> > + spin_unlock_irqrestore(&pair->buf.lock, flags); >> >> tty_flip_buffer_push() or something? >> >> > + wake_up_interruptible(&pair->read_wait); >> > + wake_up_interruptible(&pair->write_wait); >> >> It seems, this sets TTY_EOFPENDING, but if flush_to_ldisc() was done >> already here, anybody doesn't set TTY_EOF for master. > > Does putting a tty_flip_buffer_push() at that point fix it. I had thought > I could remove it but you are right that creates a situation where EOF > may never get set.
With this patch, test program seems to work.
It seems "done = 0" hunk was needed for correct "done".
Thanks.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> --- drivers/char/pty.c | 1 + drivers/char/tty_buffer.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff -puN drivers/char/pty.c~pty-fixes4-fix drivers/char/pty.c --- linux-2.6/drivers/char/pty.c~pty-fixes4-fix 2009-07-27 23:56:27.000000000 +0900 +++ linux-2.6-hirofumi/drivers/char/pty.c 2009-07-27 23:56:40.000000000 +0900 @@ -64,6 +64,7 @@ static void pty_close(struct tty_struct set_bit(TTY_EOFPENDING, &pair->flags); set_bit(TTY_OTHER_CLOSED, &pair->flags); spin_unlock_irqrestore(&pair->buf.lock, flags); + tty_flip_buffer_push(pair); wake_up_interruptible(&pair->read_wait); wake_up_interruptible(&pair->write_wait); if (tty->driver->subtype == PTY_TYPE_MASTER) { diff -puN drivers/char/tty_buffer.c~pty-fixes4-fix drivers/char/tty_buffer.c --- linux-2.6/drivers/char/tty_buffer.c~pty-fixes4-fix 2009-07-27 23:57:27.000000000 +0900 +++ linux-2.6-hirofumi/drivers/char/tty_buffer.c 2009-07-27 23:57:30.000000000 +0900 @@ -443,10 +443,8 @@ static void flush_to_ldisc(struct work_s done = 0; break; } - if (count > tty->receive_room) { + if (count > tty->receive_room) count = tty->receive_room; - done = 0; - } char_buf = head->char_buf_ptr + head->read; flag_buf = head->flag_buf_ptr + head->read; head->read += count; _ -- OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
|  |