From e62ce959d08c7468e4261773593a08443a6b5d58 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Thu, 23 Dec 1999 21:43:25 +0000 Subject: [PATCH] Don't bother fork()ing after closing a ctty if ppp is about to terminate anyway. --- usr.sbin/ppp/bundle.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index c61f388104a8..d55172d1b940 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -1697,6 +1697,16 @@ bundle_setsid(struct bundle *bundle, int holdsession) char done; struct datalink *dl; + if (!holdsession && bundle_IsDead(bundle)) { + /* + * No need to lose our session after all... we're going away anyway + * + * We should really stop the timer and pause if holdsession is set and + * the bundle's dead, but that leaves other resources lying about :-( + */ + return; + } + orig = getpid(); if (pipe(fds) == -1) { log_Printf(LogERROR, "pipe: %s\n", strerror(errno));