lkml.org 
[lkml]   [2010]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] tty: Add EXTPROC support for LINEMODE
hyc@symas.com wrote:
> This patch is against the 2.6.34 source.
> @@ -1632,6 +1638,11 @@ static int copy_from_read_buf(struct tty_struct *tty,
> spin_lock_irqsave(&tty->read_lock, flags);
> tty->read_tail = (tty->read_tail + n)& (N_TTY_BUF_SIZE-1);
> tty->read_cnt -= n;
> + /* Check if last character is EOF */
> + if (L_EXTPROC(tty)&& tty->icanon) {
> + if (!tty->read_cnt&& (*b)[n-1] == EOF_CHAR(tty))
> + n--;
> + }
> spin_unlock_irqrestore(&tty->read_lock, flags);
> *b += n;
> *nr -= n;

This bit is wrong, only a naked EOF all by itself should be dropped. Should
add this to the above:

diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index bba123e..428f4fe 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1638,8 +1638,8 @@ static int copy_from_read_buf(struct tty_struct *tty,
spin_lock_irqsave(&tty->read_lock, flags);
tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
tty->read_cnt -= n;
- /* Check if last character is EOF */
- if (L_EXTPROC(tty) && tty->icanon) {
+ /* Turn single EOF into zero-length read */
+ if (L_EXTPROC(tty) && tty->icanon && n == 1) {
if (!tty->read_cnt && (*b)[n-1] == EOF_CHAR(tty))
n--;
}

--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/


\
 
 \ /
  Last update: 2010-06-19 00:23    [W:0.072 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site