summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-09-22 00:46:56 +0000
committerbrian <brian@FreeBSD.org>1997-09-22 00:46:56 +0000
commit5e4ed6c8541fc07b1eb6971cd44ee732ebcb66d3 (patch)
treefe5562a0bdcd18c7052517572eefa55caa014831 /usr.sbin/ppp/main.c
parent2982eff94c3ed9ab3f10f5e79ea41d0eeb5dc2bc (diff)
downloadFreeBSD-src-5e4ed6c8541fc07b1eb6971cd44ee732ebcb66d3.zip
FreeBSD-src-5e4ed6c8541fc07b1eb6971cd44ee732ebcb66d3.tar.gz
Correct the way the uucp lock file and the ttyXX.if lock
file get created. We don't create lock files over non-tty connections, but we *do* create lock files in -direct mode. This leaves us capable of adding utmp/wtmp support for successful pap & chap logins (coming soon).
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r--usr.sbin/ppp/main.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index ea257a5..8eb55fa 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: main.c,v 1.79 1997/09/18 00:15:25 brian Exp $
+ * $Id: main.c,v 1.80 1997/09/21 20:26:46 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -448,27 +448,6 @@ main(int argc, char **argv)
} else if (mode & MODE_BACKGROUND)
close(BGFiledes[0]);
}
- snprintf(pid_filename, sizeof(pid_filename), "%stun%d.pid",
- _PATH_VARRUN, tunno);
- (void) unlink(pid_filename);
-
- if ((lockfile = fopen(pid_filename, "w")) != NULL) {
- fprintf(lockfile, "%d\n", (int) getpid());
- fclose(lockfile);
- } else
- LogPrintf(LogALERT, "Warning: Can't create %s: %s\n",
- pid_filename, strerror(errno));
-
- snprintf(if_filename, sizeof if_filename, "%s%s.if",
- _PATH_VARRUN, VarBaseDevice);
- (void) unlink(if_filename);
-
- if ((lockfile = fopen(if_filename, "w")) != NULL) {
- fprintf(lockfile, "tun%d\n", tunno);
- fclose(lockfile);
- } else
- LogPrintf(LogALERT, "Warning: Can't create %s: %s\n",
- if_filename, strerror(errno));
VarTerm = 0; /* We know it's currently stdout */
close(1);
@@ -488,6 +467,18 @@ main(int argc, char **argv)
TtyInit(0);
TtyCommandMode(1);
}
+
+ snprintf(pid_filename, sizeof(pid_filename), "%stun%d.pid",
+ _PATH_VARRUN, tunno);
+ (void) unlink(pid_filename);
+
+ if ((lockfile = fopen(pid_filename, "w")) != NULL) {
+ fprintf(lockfile, "%d\n", (int) getpid());
+ fclose(lockfile);
+ } else
+ LogPrintf(LogALERT, "Warning: Can't create %s: %s\n",
+ pid_filename, strerror(errno));
+
LogPrintf(LogPHASE, "PPP Started.\n");
OpenPOWER on IntegriCloud