X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fmain.c;h=6e50947000ed65e620bb12089582ef306bf54fc0;hb=428d4139c39999841f8ecc76a8b3414fd93edd3f;hp=640782ad6f35d03b02f08d583733669734943acd;hpb=71d3de90eae52087b405e962ca650b71cec79c67;p=ppp.git diff --git a/pppd/main.c b/pppd/main.c index 640782a..6e50947 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -40,7 +40,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: main.c,v 1.128 2003/06/11 23:56:26 paulus Exp $" +#define RCSID "$Id: main.c,v 1.132 2004/02/02 02:52:51 carlsonj Exp $" #include #include @@ -589,7 +589,8 @@ main(argc, argv) */ disconnect: new_phase(PHASE_DISCONNECT); - the_channel->disconnect(); + if (the_channel->disconnect) + the_channel->disconnect(); fail: if (the_channel->cleanup) @@ -1172,6 +1173,7 @@ print_link_stats() info("Connect time %d.%d minutes.", t/10, t%10); info("Sent %u bytes, received %u bytes.", link_stats.bytes_out, link_stats.bytes_in); + link_stats_valid = 0; } } @@ -1337,8 +1339,8 @@ kill_my_pg(sig) act.sa_handler = SIG_IGN; act.sa_flags = 0; - kill(0, sig); sigaction(sig, &act, &oldact); + kill(0, sig); sigaction(sig, &oldact, NULL); } @@ -1503,6 +1505,7 @@ device_script(program, in, out, dont_wait) int pid; int status = -1; int errfd; + int fd; ++conn_running; pid = safe_fork(); @@ -1530,6 +1533,14 @@ device_script(program, in, out, dont_wait) /* here we are executing in the child */ + /* make sure fds 0, 1, 2 are occupied */ + while ((fd = dup(in)) >= 0) { + if (fd > 2) { + close(fd); + break; + } + } + /* dup in and out to fds > 2 */ { int fd1 = in, fd2 = out, fd3 = log_to_fd;