diff options
| author | Karl Heuer | 1995-06-05 12:35:03 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-05 12:35:03 +0000 |
| commit | 7e32a4fbae95a023fefcd1c2a2cd8e16988cd7a7 (patch) | |
| tree | 72d435abb254c277755434cd2eba930211e6e781 /src/sysdep.c | |
| parent | 866f60fd75b9d17375fab7c793da9821952dbd06 (diff) | |
| download | emacs-7e32a4fbae95a023fefcd1c2a2cd8e16988cd7a7.tar.gz emacs-7e32a4fbae95a023fefcd1c2a2cd8e16988cd7a7.zip | |
(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) | |||
| 1130 | /* The initial tty mode bits */ | 1130 | /* The initial tty mode bits */ |
| 1131 | struct emacs_tty old_tty; | 1131 | struct emacs_tty old_tty; |
| 1132 | 1132 | ||
| 1133 | int term_initted; /* 1 if outer tty status has been recorded */ | 1133 | /* 1 if we have been through init_sys_modes. */ |
| 1134 | int term_initted; | ||
| 1135 | |||
| 1136 | /* 1 if outer tty status has been recorded. */ | ||
| 1137 | int old_tty_valid; | ||
| 1134 | 1138 | ||
| 1135 | #ifdef BSD4_1 | 1139 | #ifdef BSD4_1 |
| 1136 | /* BSD 4.1 needs to keep track of the lmode bits in order to start | 1140 | /* BSD 4.1 needs to keep track of the lmode bits in order to start |
| @@ -1220,6 +1224,8 @@ init_sys_modes () | |||
| 1220 | { | 1224 | { |
| 1221 | EMACS_GET_TTY (input_fd, &old_tty); | 1225 | EMACS_GET_TTY (input_fd, &old_tty); |
| 1222 | 1226 | ||
| 1227 | old_tty_valid = 1; | ||
| 1228 | |||
| 1223 | tty = old_tty; | 1229 | tty = old_tty; |
| 1224 | 1230 | ||
| 1225 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 1231 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) |
| @@ -1650,8 +1656,9 @@ reset_sys_modes () | |||
| 1650 | reset_sigio (); | 1656 | reset_sigio (); |
| 1651 | #endif /* BSD4_1 */ | 1657 | #endif /* BSD4_1 */ |
| 1652 | 1658 | ||
| 1653 | while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR) | 1659 | if (old_tty_valid) |
| 1654 | ; | 1660 | while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR) |
| 1661 | ; | ||
| 1655 | 1662 | ||
| 1656 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ | 1663 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ |
| 1657 | dos_ttcooked (); | 1664 | dos_ttcooked (); |