process. Otherwise, we may be stopped by SIGTTOU when we try to
update the terminal settings when cleaning up.
--HG--
branch : 1.7
flush_output();
if (io_fds[SFD_USERTTY] != -1) {
- do {
- n = term_restore(io_fds[SFD_USERTTY], 0);
- } while (!n && errno == EINTR);
+ check_foreground();
+ if (foreground) {
+ do {
+ n = term_restore(io_fds[SFD_USERTTY], 0);
+ } while (!n && errno == EINTR);
+ }
}
/* If child was signalled, write the reason to stdout like the shell. */
}
return close(fd);
}
+
+void
+cleanup_pty(gotsignal)
+ int gotsignal;
+{
+ if (io_fds[SFD_USERTTY] != -1) {
+ check_foreground();
+ if (foreground)
+ term_restore(io_fds[SFD_USERTTY], 0);
+ }
+}
io_log_close();
#endif
}
- term_restore(STDIN_FILENO, 0);
+#ifdef _PATH_SUDO_IO_LOGDIR
+ cleanup_pty(gotsignal);
+#endif
#ifdef HAVE_SELINUX
selinux_restore_tty();
#endif
void save_signals __P((void));
void restore_signals __P((void));
+/* exec_pty.c */
+void cleanup_pty __P((int gotsignal));
+
/* fileops.c */
char *sudo_parseln __P((FILE *));
int lock_file __P((int, int));