kernel32: Always uninitialize the terminal for the console shell process.
The terminal raw IO check and the console shell process check are used separately to initialize the terminal in different ways. However, if either check fails during uninitialization, then no uninitialization will occur at all and modified terminfo settings will remain instead of being restored. We should check each condition individually and uninitialize each part as required. Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
19eaed6a38
commit
df718b8ab8
|
@ -211,15 +211,18 @@ static BOOL put_console_into_raw_mode(int fd)
|
|||
static BOOL restore_console_mode(HANDLE hin)
|
||||
{
|
||||
int fd;
|
||||
BOOL ret;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
if (S_termios_raw)
|
||||
{
|
||||
if ((fd = get_console_bare_fd(hin)) == -1) return FALSE;
|
||||
ret = tcsetattr(fd, TCSANOW, &S_termios) >= 0;
|
||||
close(fd);
|
||||
}
|
||||
|
||||
if (RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle == KERNEL32_CONSOLE_SHELL)
|
||||
TERM_Exit();
|
||||
|
||||
if (!S_termios_raw ||
|
||||
RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != KERNEL32_CONSOLE_SHELL)
|
||||
return TRUE;
|
||||
if ((fd = get_console_bare_fd(hin)) == -1) return FALSE;
|
||||
ret = tcsetattr(fd, TCSANOW, &S_termios) >= 0;
|
||||
close(fd);
|
||||
TERM_Exit();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue