Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304205
b: refs/heads/master
c: 3fa10cc
h: refs/heads/master
i:
  304203: 76ba3f9
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Apr 30, 2012
1 parent 5d8bdf7 commit cf79202
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5d1a33fa5573702394a4d09a9872f3f930c06d58
refs/heads/master: 3fa10cc83fb92750af11fab81e11ad96dc75d656
9 changes: 5 additions & 4 deletions trunk/drivers/tty/n_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,7 @@ static int copy_from_read_buf(struct tty_struct *tty,
int retval;
size_t n;
unsigned long flags;
bool is_eof;

retval = 0;
spin_lock_irqsave(&tty->read_lock, flags);
Expand All @@ -1639,15 +1640,15 @@ static int copy_from_read_buf(struct tty_struct *tty,
if (n) {
retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n);
n -= retval;
is_eof = n == 1 &&
tty->read_buf[tty->read_tail] == EOF_CHAR(tty);
tty_audit_add_data(tty, &tty->read_buf[tty->read_tail], n);
spin_lock_irqsave(&tty->read_lock, flags);
tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
tty->read_cnt -= n;
/* 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--;
}
if (L_EXTPROC(tty) && tty->icanon && is_eof && !tty->read_cnt)
n = 0;
spin_unlock_irqrestore(&tty->read_lock, flags);
*b += n;
*nr -= n;
Expand Down

0 comments on commit cf79202

Please sign in to comment.