From: Frank Cusack Date: Mon, 12 May 2003 07:31:36 +0000 (+0000) Subject: When not in demand mode, defer create_linkpidfile() until we successfully X-Git-Tag: ppp-2.4.7~295 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=a0af5342ed838a6bbc6407def5eee2889435a57a When not in demand mode, defer create_linkpidfile() until we successfully get a ppp interface. This fixes a bug reported by belle_eden@caramail.com where pppd might wipe out a still-running previous pppd's pid file. --- diff --git a/pppd/main.c b/pppd/main.c index d92fdeb..8511503 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.126 2003/04/07 00:01:45 paulus Exp $" +#define RCSID "$Id: main.c,v 1.127 2003/05/12 07:31:36 fcusack Exp $" #include #include @@ -438,8 +438,6 @@ main(argc, argv) waiting = 0; - create_linkpidfile(getpid()); - /* * If we're doing dial-on-demand, set up the interface now. */ @@ -459,6 +457,7 @@ main(argc, argv) * Configure the interface and mark it up, etc. */ demand_conf(); + create_linkpidfile(getpid()); } do_callback = 0; @@ -515,6 +514,9 @@ main(argc, argv) status = EXIT_FATAL_ERROR; goto disconnect; } + /* create the pid file, now that we've obtained a ppp interface */ + if (!demand) + create_linkpidfile(getpid()); if (!demand && ifunit >= 0) set_ifunit(1);