X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Ftty.c;fp=pppd%2Ftty.c;h=a9832d918d076a0bd8634091d9086269c353de1f;hb=8f09debe1ccab6c267f1d803bfa6facdd30b56e0;hp=c356483d1974ee9358010cc585049eddcc1de569;hpb=e889f0912c1cff3c33f6419a5cf048471b8f75a9;p=ppp.git diff --git a/pppd/tty.c b/pppd/tty.c index c356483..a9832d9 100644 --- a/pppd/tty.c +++ b/pppd/tty.c @@ -68,12 +68,13 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: tty.c,v 1.25 2006/06/04 07:04:57 paulus Exp $" +#define RCSID "$Id: tty.c,v 1.26 2008/06/23 11:44:06 paulus Exp $" #include #include #include #include +#include #include #include #include @@ -688,11 +689,11 @@ int connect_tty() if (device_script(initializer, ttyfd, ttyfd, 0) < 0) { error("Initializer script failed"); status = EXIT_INIT_FAILED; - goto errret; + goto errretf; } if (got_sigterm) { disconnect_tty(); - goto errret; + goto errretf; } info("Serial port initialized."); } @@ -701,11 +702,11 @@ int connect_tty() if (device_script(connector, ttyfd, ttyfd, 0) < 0) { error("Connect script failed"); status = EXIT_CONNECT_FAILED; - goto errret; + goto errretf; } if (got_sigterm) { disconnect_tty(); - goto errret; + goto errretf; } info("Serial connection established."); } @@ -754,6 +755,9 @@ int connect_tty() return ttyfd; + errretf: + if (real_ttyfd >= 0) + tcflush(real_ttyfd, TCIOFLUSH); errret: if (pty_master >= 0) { close(pty_master); @@ -941,7 +945,7 @@ start_charshunt(ifd, ofd) exit(0); } charshunt_pid = cpid; - record_child(cpid, "pppd (charshunt)", charshunt_done, NULL); + record_child(cpid, "pppd (charshunt)", charshunt_done, NULL, 1); return 1; }