Drop the pid file after we call the final daemon call. w/o -n would

give the wrong pid.

Submitted by: ru and Lukas Ertl
PR: 54113
This commit is contained in:
Warner Losh 2003-07-05 00:43:50 +00:00
parent b215f4334a
commit fd6a8f23ef
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117246

View File

@ -596,6 +596,7 @@ event_loop(void)
if (Dflag)
fprintf(stderr, "Calling daemon\n");
daemon(0, 0);
cfg.drop_pidfile();
once++;
}
}
@ -743,9 +744,10 @@ main(int argc, char **argv)
}
cfg.parse();
if (!dflag && nflag)
if (!dflag && nflag) {
daemon(0, 0);
cfg.drop_pidfile();
cfg.drop_pidfile();
}
signal(SIGHUP, gensighand);
signal(SIGINT, gensighand);
signal(SIGTERM, gensighand);