]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
n_tty: Fix handling of control characters and continuations
authorJoe Peterson <joe@skyrush.com>
Fri, 2 Jan 2009 13:43:25 +0000 (13:43 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Jan 2009 18:19:37 +0000 (10:19 -0800)
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>
drivers/char/n_tty.c

index a223823544bfe33c2f325cb7b8d0fbb3629626fa..30b0426b3788ffc6c523beaa37cdc5c1d156ef7a 100644 (file)
@@ -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;
                }
        }