X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fmain.c;h=3273cdf9aa32412a282bafdafb54758b6dd1f9b9;hp=2f17a69ed0d6933a3f2bfcbfdb374249cbc2f1b8;hb=d360980f566acea27d4b61566ded5cb064559cca;hpb=9678d8e116c5f9ae854b9f744ebf3f6aae85d16a diff --git a/pppd/main.c b/pppd/main.c index 2f17a69..3273cdf 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: main.c,v 1.41 1997/04/30 05:54:52 paulus Exp $"; +static char rcsid[] = "$Id: main.c,v 1.44 1998/02/04 01:40:59 paulus Exp $"; #endif #include @@ -40,7 +40,6 @@ static char rcsid[] = "$Id: main.c,v 1.41 1997/04/30 05:54:52 paulus Exp $"; #include #include #include -#include #include "pppd.h" #include "magic.h" @@ -69,7 +68,7 @@ extern char *strerror(); #endif /* interface vars */ -char ifname[IFNAMSIZ]; /* Interface name */ +char ifname[32]; /* Interface name */ int ifunit; /* Interface unit number */ char *progname; /* Name of this program */ @@ -161,7 +160,7 @@ main(argc, argv) int argc; char *argv[]; { - int i, nonblock, fdflags; + int i, fdflags; struct sigaction sa; FILE *pidfile; char *p; @@ -453,7 +452,15 @@ main(argc, argv) if (connector && connector[0]) { MAINDEBUG((LOG_INFO, "Connecting with <%s>", connector)); - /* set line speed, flow control, etc.; set CLOCAL for now */ + /* + * Set line speed, flow control, etc. + * On most systems we set CLOCAL for now so that we can talk + * to the modem before carrier comes up. But this has the + * side effect that we might miss it if CD drops before we + * get to clear CLOCAL below. On systems where we can talk + * successfully to the modem with CLOCAL clear and CD down, + * we can clear CLOCAL at this point. + */ set_up_tty(ttyfd, 1); /* drop dtr to hang up in case modem is off hook */ @@ -469,6 +476,7 @@ main(argc, argv) goto fail; } + syslog(LOG_INFO, "Serial connection established."); sleep(1); /* give it time to set up its terminal */ } @@ -481,7 +489,7 @@ main(argc, argv) while ((i = open(devnam, O_RDWR)) < 0) { if (errno != EINTR) syslog(LOG_ERR, "Failed to reopen %s: %m", devnam); - if (!persist || errno != EINTR) + if (!persist || errno != EINTR || hungup || kill_link) goto fail; } close(i); @@ -577,7 +585,7 @@ main(argc, argv) } if (!persist) - break; + die(1); if (demand) demand_discard();