[PATCH v2 1/4] terminal: always reset terminal when reading without echo
- From
- Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Feb 22, 2022, 18:53 UTC
- Message-ID
- <45609d61afc647de3afafc4203d904676837ffe3.1645556015.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1146.v2.git.1645556015.gitgitgadget@gmail.com>
From: Phillip Wood <phillip.wood@dunelm.org.uk>
Break out of the loop to ensure restore_term() is called before returning.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> --- compat/terminal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compat/terminal.c b/compat/terminal.c index 5b903e7c7e3..fb8c70a6251 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -385,7 +385,7 @@ int read_key_without_echo(struct strbuf *buf) ch = getchar(); if (ch == EOF) - return 0; + break; strbuf_addch(buf, ch); } }
-- gitgitgadget