diff options
Diffstat (limited to 'usr.sbin/route6d')
-rw-r--r-- | usr.sbin/route6d/route6d.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 696a9bc..e8d06bb 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -349,6 +349,14 @@ main(argc, argv) nflag = 1; fprintf(stderr, "No kernel update is allowed\n"); } + + if (dflag == 0) { + if (daemon(0, 0) < 0) { + fatal("daemon"); + /*NOTREACHED*/ + } + } + openlog(progname, LOG_NDELAY|LOG_PID, LOG_DAEMON); logopened++; @@ -389,21 +397,6 @@ main(argc, argv) if (dflag) ifrtdump(0); - if (dflag == 0) { -#if 1 - if (daemon(0, 0) < 0) { - fatal("daemon"); - /*NOTREACHED*/ - } -#else - if (fork()) - exit(0); - if (setsid() < 0) { - fatal("setid"); - /*NOTREACHED*/ - } -#endif - } pid = getpid(); if ((pidfile = fopen(ROUTE6D_PID, "w")) != NULL) { fprintf(pidfile, "%d\n", pid); |