1 commit 62b263585bb5005d44a764c90d80f9c4bb8188c1
2 Author: Joe Peterson <joe@skyrush.com>
3 Date: Wed Sep 9 15:03:47 2009 -0600
5 n_tty: move echoctl check and clean up logic
7 Check L_ECHOCTL before insertting a character in the echo buffer
8 (rather than as the buffer is processed), to be more consistent with
9 when all other L_ flags are checked. Also cleaned up the related logic.
11 Note that this and the previous patch ("n_tty: honor opost flag for echoes")
12 were verified together by the reporters of the bug that patch addresses
13 (http://bugs.linuxbase.org/show_bug.cgi?id=2692), and the test now passes.
15 Signed-off-by: Joe Peterson <joe@skyrush.com>
16 Cc: Linus Torvalds <torvalds@linux-foundation.org>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19 diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
20 index e6eeeb2..2e50f4d 100644
21 --- a/drivers/char/n_tty.c
22 +++ b/drivers/char/n_tty.c
23 @@ -576,33 +576,23 @@ static void process_echoes(struct tty_struct *tty)
28 - if (L_ECHOCTL(tty)) {
30 - * Ensure there is enough space
31 - * for the whole ctrl pair.
37 - tty_put_char(tty, '^');
38 - tty_put_char(tty, op ^ 0100);
46 - tty_put_char(tty, op);
51 - * If above falls through, this was an
53 + * If the op is not a special byte code,
54 + * it is a ctrl char tagged to be echoed
55 + * as "^X" (where X is the letter
56 + * representing the control char).
57 + * Note that we must ensure there is
58 + * enough space for the whole ctrl pair.
65 + tty_put_char(tty, '^');
66 + tty_put_char(tty, op ^ 0100);
72 @@ -809,8 +799,8 @@ static void echo_char_raw(unsigned char c, struct tty_struct *tty)
73 * Echo user input back onto the screen. This must be called only when
74 * L_ECHO(tty) is true. Called from the driver receive_buf path.
76 - * This variant tags control characters to be possibly echoed as
77 - * as "^X" (where X is the letter representing the control char).
78 + * This variant tags control characters to be echoed as "^X"
79 + * (where X is the letter representing the control char).
81 * Locking: echo_lock to protect the echo buffer
83 @@ -823,7 +813,7 @@ static void echo_char(unsigned char c, struct tty_struct *tty)
84 add_echo_byte(ECHO_OP_START, tty);
85 add_echo_byte(ECHO_OP_START, tty);
87 - if (iscntrl(c) && c != '\t')
88 + if (L_ECHOCTL(tty) && iscntrl(c) && c != '\t')
89 add_echo_byte(ECHO_OP_START, tty);
90 add_echo_byte(c, tty);