summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-06-16 13:24:59 +0000
committerbrian <brian@FreeBSD.org>1997-06-16 13:24:59 +0000
commit95a0b5dc63f75c34c5a65a212e32d76ef52b044b (patch)
tree1b567b0159c3c3a3e539397604ae360dc1d2e97c /usr.sbin/ppp/main.c
parent873f44aa06cb0b04491c6cdadf33a9e6573d39ff (diff)
downloadFreeBSD-src-95a0b5dc63f75c34c5a65a212e32d76ef52b044b.zip
FreeBSD-src-95a0b5dc63f75c34c5a65a212e32d76ef52b044b.tar.gz
Remove call to daemon(). Just call setsid() and close
any relevent descriptors (0,2,[1]). We've already fork()d. PR: 3874
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r--usr.sbin/ppp/main.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index e557ddd..3943001 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.60 1997/06/09 03:27:28 brian Exp $
+ * $Id: main.c,v 1.61 1997/06/11 03:57:48 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -510,17 +510,20 @@ char **argv;
if (server >= 0)
LogPrintf(LogPHASE, "Listening at %d.\n", port);
- VarTerm = 0; /* We know it's currently stdin */
+ VarTerm = 0; /* We know it's currently stdout */
+ close(0);
+ close(2);
#ifdef DOTTYINIT
- if (mode & (MODE_DIRECT|MODE_DEDICATED)) { /* } */
+ if (mode & (MODE_DIRECT|MODE_DEDICATED))
#else
- if (mode & MODE_DIRECT) {
+ if (mode & MODE_DIRECT)
#endif
- chdir("/"); /* Be consistent with daemon() */
TtyInit();
- } else
- daemon(0,0);
+ else {
+ setsid();
+ close(1);
+ }
} else {
TtyInit();
TtyCommandMode(1);
OpenPOWER on IntegriCloud