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:
imp 2003-07-05 00:43:50 +00:00
parent f043783725
commit 738a947fd0

View File

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