Commit df718b8a authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

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: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 19eaed6a
...@@ -211,15 +211,18 @@ static BOOL put_console_into_raw_mode(int fd) ...@@ -211,15 +211,18 @@ static BOOL put_console_into_raw_mode(int fd)
static BOOL restore_console_mode(HANDLE hin) static BOOL restore_console_mode(HANDLE hin)
{ {
int fd; int fd;
BOOL ret; BOOL ret = TRUE;
if (!S_termios_raw || if (S_termios_raw)
RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != KERNEL32_CONSOLE_SHELL) {
return TRUE;
if ((fd = get_console_bare_fd(hin)) == -1) return FALSE; if ((fd = get_console_bare_fd(hin)) == -1) return FALSE;
ret = tcsetattr(fd, TCSANOW, &S_termios) >= 0; ret = tcsetattr(fd, TCSANOW, &S_termios) >= 0;
close(fd); close(fd);
}
if (RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle == KERNEL32_CONSOLE_SHELL)
TERM_Exit(); TERM_Exit();
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment