From 7e32a4fbae95a023fefcd1c2a2cd8e16988cd7a7 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Mon, 5 Jun 1995 12:35:03 +0000 Subject: [PATCH] (old_tty_valid): New variable. (init_sys_modes): Set old_tty_valid if we set old_tty. (reset_sys_modes): Restore tty settings only if old_tty_valid. --- src/sysdep.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sysdep.c b/src/sysdep.c index 41bbd92c43..9d352ab1be 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1130,7 +1130,11 @@ emacs_set_tty (fd, settings, waitp) /* The initial tty mode bits */ struct emacs_tty old_tty; -int term_initted; /* 1 if outer tty status has been recorded */ +/* 1 if we have been through init_sys_modes. */ +int term_initted; + +/* 1 if outer tty status has been recorded. */ +int old_tty_valid; #ifdef BSD4_1 /* BSD 4.1 needs to keep track of the lmode bits in order to start @@ -1220,6 +1224,8 @@ init_sys_modes () { EMACS_GET_TTY (input_fd, &old_tty); + old_tty_valid = 1; + tty = old_tty; #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) @@ -1650,8 +1656,9 @@ reset_sys_modes () reset_sigio (); #endif /* BSD4_1 */ - while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR) - ; + if (old_tty_valid) + while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR) + ; #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ dos_ttcooked (); -- 2.20.1