Message ID | 20191025073328.643-6-daniel.thompson@linaro.org |
---|---|
State | Accepted |
Commit | c58ff643763c78bef12874ee39995c9f7f987bc2 |
Headers | show |
Series | kdb: Cleanup code to read user input and handle escape sequences | expand |
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index f794c0ca4557..8bcdded5d61f 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -163,8 +163,8 @@ char kdb_getchar(void) *pbuf++ = key; key = kdb_handle_escape(buf, pbuf - buf); - if (key < 0) /* no escape sequence; return first character */ - return buf[0]; + if (key < 0) /* no escape sequence; return best character */ + return buf[pbuf - buf == 2 ? 1 : 0]; if (key > 0) return key; }