summaryrefslogtreecommitdiffstats
path: root/drivers/char/n_tty.c
diff options
context:
space:
mode:
authorJoe Peterson <joe@skyrush.com>2009-01-02 13:43:25 +0000
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 10:19:37 -0800
commita59c0d6f14315a3f300f6f3786137213727e4c47 (patch)
treea6cccef67a4ed016242f67a9a6136b7bc2a72fff /drivers/char/n_tty.c
parentfc6f6238226e6d1248e1967eae2bf556eaf3ac17 (diff)
downloadop-kernel-dev-a59c0d6f14315a3f300f6f3786137213727e4c47.zip
op-kernel-dev-a59c0d6f14315a3f300f6f3786137213727e4c47.tar.gz
n_tty: Fix handling of control characters and continuations
Fix process_output_block to detect continuation characters correctly and to handle control characters even when O_OLCUC is enabled. Make similar change to do_output_char(). Signed-off-by: Joe Peterson <joe@skyrush.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/n_tty.c')
-rw-r--r--drivers/char/n_tty.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index a223823..30b0426 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -351,10 +351,12 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
tty->column--;
break;
default:
- if (O_OLCUC(tty))
- c = toupper(c);
- if (!iscntrl(c) && !is_continuation(c, tty))
- tty->column++;
+ if (!iscntrl(c)) {
+ if (O_OLCUC(tty))
+ c = toupper(c);
+ if (!is_continuation(c, tty))
+ tty->column++;
+ }
break;
}
@@ -425,7 +427,9 @@ static ssize_t process_output_block(struct tty_struct *tty,
nr = space;
for (i = 0, cp = buf; i < nr; i++, cp++) {
- switch (*cp) {
+ unsigned char c = *cp;
+
+ switch (c) {
case '\n':
if (O_ONLRET(tty))
tty->column = 0;
@@ -447,10 +451,12 @@ static ssize_t process_output_block(struct tty_struct *tty,
tty->column--;
break;
default:
- if (O_OLCUC(tty))
- goto break_out;
- if (!iscntrl(*cp))
- tty->column++;
+ if (!iscntrl(c)) {
+ if (O_OLCUC(tty))
+ goto break_out;
+ if (!is_continuation(c, tty))
+ tty->column++;
+ }
break;
}
}
OpenPOWER on IntegriCloud