assert(kill_pid == 0 || kill_pid > 1);
assert(signo >= 0 && signo < _NSIG);
- fd_nonblock(STDIN_FILENO, 1);
- fd_nonblock(STDOUT_FILENO, 1);
- fd_nonblock(master, 1);
+ fd_nonblock(STDIN_FILENO, true);
+ fd_nonblock(STDOUT_FILENO, true);
+ fd_nonblock(master, true);
signal_fd = signalfd(-1, mask, SFD_NONBLOCK|SFD_CLOEXEC);
if (signal_fd < 0) {
int process_pty(int master, sigset_t *mask, pid_t kill_pid, int signo) {
struct termios saved_stdin_attr, raw_stdin_attr;
struct termios saved_stdout_attr, raw_stdout_attr;
- struct termios master_attr;
- bool saved_stdin = false, saved_stdout = false;
+ bool saved_stdin = false;
+ bool saved_stdout = false;
struct winsize ws;
int r;
tcsetattr(STDOUT_FILENO, TCSANOW, &raw_stdout_attr);
}
- if (tcgetattr(master, &master_attr) >= 0) {
- cfmakeraw(&master_attr);
- tcsetattr(master, TCSANOW, &master_attr);
- }
-
r = process_pty_loop(master, mask, kill_pid, signo);
if (saved_stdout)
if (saved_stdin)
tcsetattr(STDIN_FILENO, TCSANOW, &saved_stdin_attr);
+ /* STDIN/STDOUT should not be nonblocking normally, so let's
+ * unconditionally reset it */
+ fd_nonblock(STDIN_FILENO, false);
+ fd_nonblock(STDOUT_FILENO, false);
+
return r;
}