From e0d8cc391d650e6b69d5d77af50a002041522151 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 28 May 1998 23:17:51 +0000 Subject: o #define the name "tun" in defs.h against the future possibility of supporting architectures with different device names. o Close /dev/tunX when destroying the bundle. o Don't forget to close the parent end of the pipe in the child process when exec'ing a program from a chat script. o If we close our controlling terminal, ditch the current session with it, allowing getty(8) (or whatever) to regain control. o After transferring our controlling terminal descriptor to another ppp instance, we now fork a new ppp to continue where we left off, transferring ownership of all uucp locks and the /var/run/tunX.pid file. Meanwhile the parent closes all file descriptors, defaults all signals and does a pause() to wait for a HUP after the transferred descriptor is finally closed. We don't run /bin/cat any more (again!). Suggested by: bde TODO: It seems clocal devices need their pause()d session leader to be given a manual HUP, as closing the last open descriptor doesn't do the job. --- usr.sbin/ppp/main.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'usr.sbin/ppp/main.c') diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 73945a5..e794a15 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,12 +17,12 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.125 1998/05/25 02:22:36 brian Exp $ + * $Id: main.c,v 1.126 1998/05/27 22:43:31 brian Exp $ * * TODO: */ -#include +#include #include #include #include @@ -78,8 +78,6 @@ #endif #endif -static char pid_filename[MAXPATHLEN]; - static void DoLoop(struct bundle *); static void TerminalStop(int); static const char *ex_desc(int); @@ -99,7 +97,6 @@ void AbortProgram(int excode) { server_Close(SignalBundle); - ID0unlink(pid_filename); log_Printf(LogPHASE, "PPP Terminated (%s).\n", ex_desc(excode)); bundle_Close(SignalBundle, NULL, 1); bundle_Destroy(SignalBundle); @@ -239,7 +236,6 @@ ProcessArgs(int argc, char **argv, int *mode) int main(int argc, char **argv) { - FILE *lockfile; char *name, *label; int nfds, mode; struct bundle *bundle; @@ -444,19 +440,6 @@ main(int argc, char **argv) prompt_Required(prompt); } - snprintf(pid_filename, sizeof pid_filename, "%stun%d.pid", - _PATH_VARRUN, bundle->unit); - lockfile = ID0fopen(pid_filename, "w"); - if (lockfile != NULL) { - fprintf(lockfile, "%d\n", (int) getpid()); - fclose(lockfile); - } -#ifndef RELEASE_CRUNCH - else - log_Printf(LogALERT, "Warning: Can't create %s: %s\n", - pid_filename, strerror(errno)); -#endif - log_Printf(LogPHASE, "PPP Started (%s mode).\n", mode2Nam(mode)); DoLoop(bundle); AbortProgram(EX_NORMAL); -- cgit v1.1