summaryrefslogtreecommitdiff
path: root/sbin/slattach/slattach.c
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
commit5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch)
treee779b5a6edddbb949b7990751b12d6f25304ba86 /sbin/slattach/slattach.c
parenta16f65c7d117419bd266c28a1901ef129a337569 (diff)
Diffstat (limited to 'sbin/slattach/slattach.c')
-rw-r--r--sbin/slattach/slattach.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c
index 66b8e1577075..8d429f06ef3a 100644
--- a/sbin/slattach/slattach.c
+++ b/sbin/slattach/slattach.c
@@ -145,6 +145,7 @@ int exiting = 0; /* allready running exit_handler */
FILE *console;
struct termios tty;
+struct termios tty_orig; /* For saving original tty state */
char devname[32];
char hostname[MAXHOSTNAMELEN];
@@ -268,6 +269,12 @@ int main(int argc, char **argv)
/* upon HUP redial and reconnect. */
if ((int)signal(SIGHUP,sighup_handler) < 0)
syslog(LOG_NOTICE,"cannot install SIGHUP handler: %s: %m");
+ /* Keep track of our original terminal values for redialing */
+ if (tcgetattr(fd, &tty_orig) < 0) {
+ syslog(LOG_ERR, "tcgetattr: %m");
+ exit_handler(1);
+ }
+
setup_line();
@@ -362,8 +369,8 @@ again:
syslog(LOG_NOTICE,"SIGHUP on %s (sl%d); running %s",
dev,unit,redial_cmd);
if (!(modem_control & CLOCAL)) {
- tty.c_cflag |= CLOCAL;
- if (tcsetattr(fd, TCSAFLUSH, &tty) < 0) {
+ tty_orig.c_cflag |= CLOCAL;
+ if (tcsetattr(fd, TCSAFLUSH, &tty_orig) < 0) {
syslog(LOG_ERR, "tcsetattr(TCSAFLUSH): %m");
exit_handler(1);
}