lkml.org 
[lkml]   [2009]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [Regression] kdesu broken
> > See the thread starting here: ("possible regression with pty.c commit")
> > http://lkml.org/lkml/2009/7/11/125
>
> I am also facing a similar problem.
>
> http://bugzilla.kernel.org/show_bug.cgi?id=13815

Probably something like this fixes it. I'll be working on that Monday/Tuesday
along with various other bugs that need a review.

--


pty: ensure writes hit the reader before close

From: Alan Cox <alan@linux.intel.com>

Logically we move the buffering from one side to the other
---

drivers/char/pty.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 6e6942c..7555890 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -36,6 +36,15 @@ static struct tty_driver *ptm_driver;
static struct tty_driver *pts_driver;
#endif

+static int pty_empty(struct tty_struct *tty)
+{
+ if (tty->buf.memory_used == 0)
+ return 1;
+ if (test_bit(TTY_HUPPED, &tty->flags))
+ return 1;
+ return 0;
+}
+
static void pty_close(struct tty_struct *tty, struct file *filp)
{
BUG_ON(!tty);
@@ -47,9 +56,11 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
}
wake_up_interruptible(&tty->read_wait);
wake_up_interruptible(&tty->write_wait);
+
tty->packet = 0;
if (!tty->link)
return;
+ wait_event_interruptible(tty->write_wait, pty_empty(tty->link));
tty->link->packet = 0;
set_bit(TTY_OTHER_CLOSED, &tty->link->flags);
wake_up_interruptible(&tty->link->read_wait);

\
 
 \ /
  Last update: 2009-07-25 14:09    [W:0.186 / U:0.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site