From: Paul Mackerras Date: Sun, 1 May 1994 11:44:43 +0000 (+0000) Subject: fixed bug in alrm; set CLOCAL bit on tty while running connector X-Git-Tag: ppp-2-1-2a~60 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=e1c700a6282f912d8f092bbc61a2172b8fc75611 fixed bug in alrm; set CLOCAL bit on tty while running connector --- diff --git a/pppd/main.c b/pppd/main.c index ad3edeb..33b3e21 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: main.c,v 1.7 1994/04/18 04:06:26 paulus Exp $"; +static char rcsid[] = "$Id: main.c,v 1.8 1994/05/01 11:44:43 paulus Exp $"; #endif #define SETSID @@ -390,13 +390,13 @@ main(argc, argv) } #endif /* TIOCSCTTY */ - /* set line speed, flow control, etc. */ - set_up_tty(fd); - /* run connection script */ if (connector) { MAINDEBUG((LOG_INFO, "Connecting with <%s>", connector)); + /* set line speed, flow control, etc.; set CLOCAL for now */ + set_up_tty(fd, 1); + /* drop dtr to hang up in case modem is off hook */ if (!default_device && modem) { setdtr(fd, FALSE); @@ -414,6 +414,9 @@ main(argc, argv) sleep(1); /* give it time to set up its terminal */ } + /* set line speed, flow control, etc.; clear CLOCAL if modem option */ + set_up_tty(fd, 0); + /* set up the serial device as a ppp interface */ establish_ppp(); @@ -617,10 +620,11 @@ baud_rate_of(speed) /* * set_up_tty: Set up the serial port on `fd' for 8 bits, no parity, - * at the requested speed, etc. + * at the requested speed, etc. If `local' is true, set CLOCAL + * regardless of whether the modem option was specified. */ -set_up_tty(fd) - int fd; +set_up_tty(fd, local) + int fd, local; { #ifndef SGTTY int speed; @@ -643,7 +647,7 @@ set_up_tty(fd) #endif /* CRTSCTS */ tios.c_cflag |= CS8 | CREAD | HUPCL; - if (!modem) + if (local || !modem) tios.c_cflag |= CLOCAL; tios.c_iflag = IGNBRK | IGNPAR; tios.c_oflag = 0; @@ -1001,6 +1005,8 @@ alrm(sig, code, scp, addr) MAINDEBUG((LOG_DEBUG, "Alarm")); + if (callout == NULL) + return; /* * Get the first scheduled timeout and any that were scheduled * for the same time as a list, and remove them all from callout