diff options
author | Karl Heuer <kwzh@gnu.org> | 1995-06-05 12:35:03 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1995-06-05 12:35:03 +0000 |
commit | 3ee5d3ab4110bbb64aea9075b9fcbd3a2b21ccb2 (patch) | |
tree | 1810ea8c3220efffefc210b1d006e661c6f3d99d /src/sysdep.c | |
parent | b3a36459dd7ac5cee8f8f9362a2166259cf00cd5 (diff) | |
download | emacs-3ee5d3ab4110bbb64aea9075b9fcbd3a2b21ccb2.tar.gz |
(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.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r-- | src/sysdep.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 41bbd92c43d..9d352ab1beb 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 (); |