X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fmain.c;h=3172485a23e77d025cfc9c18cdf972a44c3d4910;hp=638e296ba3e13702d0549f366c963cc1c0a042a6;hb=68367444b1410a825ae8301a7335ce3c78190c02;hpb=0b63a24d54ba4708c88e31bdd74b0145956c1478 diff --git a/pppd/main.c b/pppd/main.c index 638e296..3172485 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: main.c,v 1.1 1993/11/11 03:54:25 paulus Exp $"; +static char rcsid[] = "$Id: main.c,v 1.5 1994/01/10 00:18:59 paulus Exp $"; #endif #define SETSID @@ -31,6 +31,14 @@ static char rcsid[] = "$Id: main.c,v 1.1 1993/11/11 03:54:25 paulus Exp $"; #include #include +/* + * If REQ_SYSOPTIONS is defined to 1, pppd will not run unless + * /etc/ppp/options exists. + */ +#ifndef REQ_SYSOPTIONS +#define REQ_SYSOPTIONS 0 +#endif + #ifdef STREAMS #undef SGTTY #endif @@ -215,6 +223,11 @@ main(argc, argv) pid = getpid(); + if (!ppp_available()) { + fprintf(stderr, "Sorry - PPP is not available on this system\n"); + exit(1); + } + /* * Initialize to the standard option set, then parse, in order, * the system options file, the user's options file, and the command @@ -225,7 +238,7 @@ main(argc, argv) progname = *argv; - if (!options_from_file(_PATH_SYSOPTIONS) || + if (!options_from_file(_PATH_SYSOPTIONS, REQ_SYSOPTIONS) || !options_from_user() || !parse_args(argc-1, argv+1)) die(1); @@ -251,8 +264,6 @@ main(argc, argv) syslog(LOG_ERR, "getpgrp(0): %m"); die(1); } - if (pgrpid != pid) - syslog(LOG_WARNING, "warning... not a process group leader"); } else { /* @@ -328,7 +339,16 @@ main(argc, argv) signal(SIGUSR1, incdebug); /* Increment debug flag */ signal(SIGUSR2, nodebug); /* Reset debug flag */ - + + /* + * Block SIGIOs and SIGPOLLs for now + */ + sigemptyset(&mask); + sigaddset(&mask, SIGIO); +#ifdef STREAMS + sigaddset(&mask, SIGPOLL); +#endif + sigprocmask(SIG_BLOCK, &mask, NULL); /* * Open the serial device and set it up to be the ppp interface. @@ -386,14 +406,14 @@ main(argc, argv) } /* - * Set process group of device to our process group so we can get SIGIOs. + * Set process group of device to our process group so we can get + * SIGIOs and SIGHUPs. */ #ifdef SETSID if (default_device) { int id = tcgetpgrp(fd); if (id != pgrpid) { - syslog(LOG_WARNING, - "warning: not foreground process group leader"); + syslog(LOG_WARNING, "warning: not in tty's process group"); } } else { if (tcsetpgrp(fd, pgrpid) < 0) {