From: Howard Chu <hyc@symas.com>
To: linux-kernel@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk, greg@kroah.com
Subject: Re: [PATCH] tty: Add EXTPROC support for LINEMODE
Date: Fri, 18 Jun 2010 15:20:01 -0700 [thread overview]
Message-ID: <4C1BF111.6010807@symas.com> (raw)
In-Reply-To: <E1OPhUs-0000W7-M9@lirone.symas.net>
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/
next prev parent reply other threads:[~2010-06-18 22:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-18 19:45 [PATCH] tty: Add EXTPROC support for LINEMODE hyc
2010-06-18 22:20 ` Howard Chu [this message]
2010-06-22 15:59 ` Howard Chu
2010-06-22 16:03 ` Greg KH
2010-06-22 17:28 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2010-06-15 18:56 hyc
2010-06-15 19:29 ` Alan Cox
2010-06-15 19:54 ` Howard Chu
2010-06-15 20:23 ` Howard Chu
2010-06-16 15:13 ` Derek Fawcus
2010-06-17 20:02 ` Howard Chu
2010-06-17 20:49 ` Alan Cox
2010-06-17 21:23 ` Howard Chu
2010-06-17 23:43 ` Howard Chu
2010-06-16 1:15 ` Chris Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C1BF111.6010807@symas.com \
--to=hyc@symas.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.