From: "Haidong Yu" Subject: [PATCH] conhost: Input should be restored and input_thread handle should be closed before return. Message-Id: <22b1dec7.41b4.174b47e0da2.Coremail.yhd986@163.com> Date: Tue, 22 Sep 2020 14:26:34 +0800 (CST) From 53f269626de5e0b3bfe41152cc5ed5d778480293 Mon Sep 17 00:00:00 2001 From: Haidong Yu Date: Tue, 22 Sep 2020 14:01:35 +0800 Subject: [PATCH] conhost: Input should be restored and input_thread handle should be closed before return. Signed-off-by: Haidong Yu --- programs/conhost/conhost.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 4a16ae868d..f3783217a0 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -1660,6 +1660,15 @@ static DWORD WINAPI tty_input( void *param ) switch (ch) { case 3: /* end of text */ + if (console->is_unix) + { + unsigned int h = 0; + status = NtDeviceIoControlFile(console->server, NULL, NULL, NULL, &io, IOCTL_CONDRV_SETUP_INPUT, + &h, sizeof(h), NULL, 0); + if (status) ERR( "input restore failed: %#x\n", status ); + } + CloseHandle( console->input_thread ); + console->input_thread = NULL; LeaveCriticalSection( &console_section ); return 0; case '\n': -- 2.20.1