ptyfwd: turn off O_NONBLOCK on output after soft reset

Follow-up for 3d97db8f3c

terminal_reset_ansi_req() would try to put terminal in nonblocking
mode temporarily again, hence just avoid the back and forth
and reset nonblocking as last step.
This commit is contained in:
Mike Yuan
2025-12-24 08:07:59 +01:00
committed by Lennart Poettering
parent 1afe5c7b4b
commit 22eb3a6bd9
+3 -3
View File
@@ -131,9 +131,6 @@ static void pty_forward_disconnect(PTYForward *f) {
if (f->saved_stdout)
(void) tcsetattr(f->output_fd, TCSANOW, &f->saved_stdout_attr);
/* STDIN/STDOUT should not be non-blocking normally, so let's reset it */
(void) fd_nonblock(f->output_fd, false);
if (f->last_char_set && f->last_char != '\n') {
const char *s;
@@ -154,6 +151,9 @@ static void pty_forward_disconnect(PTYForward *f) {
terminal_reset_ansi_seq(f->output_fd);
}
/* STDIN/STDOUT should not be non-blocking normally, so let's reset it */
(void) fd_nonblock(f->output_fd, false);
if (f->close_output_fd)
f->output_fd = safe_close(f->output_fd);
}