Don't mix up pgroup and pid

This is another case where we used pid when we meant pgroup.

Since 55b3c45f95, the assumption that
both are the same no longer holds in all cases, so this check was wrong.

Might fix #5663.
This commit is contained in:
Fabian Homborg
2019-02-25 20:23:34 +01:00
parent a5659132f6
commit 2418e1e50b

View File

@@ -966,7 +966,7 @@ void reader_init() {
/// Restore the term mode if we own the terminal. It's important we do this before
/// restore_foreground_process_group, otherwise we won't think we own the terminal.
void restore_term_mode() {
if (getpid() != tcgetpgrp(STDIN_FILENO)) return;
if (getpgrp() != tcgetpgrp(STDIN_FILENO)) return;
if (tcsetattr(STDIN_FILENO, TCSANOW, &terminal_mode_on_startup) == -1 && errno == EIO) {
redirect_tty_output();