Messages in this thread Patch in this message | | | Date | Fri, 18 Jun 2010 15:20:01 -0700 | From | Howard Chu <> | Subject | Re: [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/
| |