summaryrefslogtreecommitdiffstats
path: root/sbin/startslip
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-09-15 17:30:03 +0000
committerache <ache@FreeBSD.org>1995-09-15 17:30:03 +0000
commitec511f82926483f27ceebf3f100517176b1ce95d (patch)
tree3012d91be1c76e780ead1e4ca2b9eee92f5517ac /sbin/startslip
parent75bbddfdb88398cdf55382f38b9a021679ac9e8d (diff)
downloadFreeBSD-src-ec511f82926483f27ceebf3f100517176b1ce95d.zip
FreeBSD-src-ec511f82926483f27ceebf3f100517176b1ce95d.tar.gz
Restore TTYDISC on exit. Move setting of control terminal
after TTYDISC setting
Diffstat (limited to 'sbin/startslip')
-rw-r--r--sbin/startslip/startslip.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sbin/startslip/startslip.c b/sbin/startslip/startslip.c
index 2ec15d8..587734a 100644
--- a/sbin/startslip/startslip.c
+++ b/sbin/startslip/startslip.c
@@ -87,8 +87,9 @@ int script_timeout = 90; /* connect script default timeout */
char *dials[MAXDIALS];
int diali, dialc;
+int fd = -1;
FILE *pfd;
-char *devname;
+char *devname, *devicename;
char pidfile[80];
#ifdef DEBUG
@@ -111,13 +112,12 @@ main(argc, argv)
extern int optind;
char *cp, **ap;
int ch, disc;
- int fd = -1;
void sighup(), sigterm();
FILE *wfd = NULL;
char *dialerstring = 0, buf[BUFSIZ];
int unitnum;
char unitname[32];
- char *devicename, *username, *password;
+ char *username, *password;
char *upscript = NULL, *downscript = NULL;
int first = 1, tries = 0;
int pausefirst = 0;
@@ -307,12 +307,6 @@ restart:
}
}
printd(" %d", fd);
-#ifdef TIOCSCTTY
- if (ioctl(fd, TIOCSCTTY, 0) < 0) {
- syslog(LOG_ERR, "ioctl (TIOCSCTTY): %m");
- down(2);
- }
-#endif
signal(SIGHUP, sighup);
signal(SIGTERM, sigterm);
if (debug) {
@@ -327,6 +321,12 @@ restart:
devicename);
down(2);
}
+#ifdef TIOCSCTTY
+ if (ioctl(fd, TIOCSCTTY, 0) < 0) {
+ syslog(LOG_ERR, "ioctl (TIOCSCTTY): %m");
+ down(2);
+ }
+#endif
printd(", ioctl");
#ifdef POSIX
if (tcgetattr(fd, &t) < 0) {
@@ -541,6 +541,11 @@ getline(buf, size, fd, timeout)
down(code)
{
+ int disc = TTYDISC;
+
+ if (fd > -1 && ioctl(fd, TIOCSETD, &disc) < 0)
+ syslog(LOG_ERR, "%s: ioctl (TIOCSETD 0): %m",
+ devicename);
if (pfd)
unlink(pidfile);
if (locked)
OpenPOWER on IntegriCloud