changeset 12070:305d8df294a5

(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.
author Karl Heuer <kwzh@gnu.org>
date Mon, 05 Jun 1995 12:35:03 +0000
parents 505dc29a68cf
children f85f23c50344
files src/sysdep.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Mon Jun 05 12:32:41 1995 +0000
+++ b/src/sysdep.c	Mon Jun 05 12:35:03 1995 +0000
@@ -1130,7 +1130,11 @@
 /* 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 @@
     {
       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_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 ();