From fd6a8f23ef43ea76e0ba08bd8e78d135fa4ed331 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 5 Jul 2003 00:43:50 +0000 Subject: [PATCH] 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 --- sbin/devd/devd.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc index 2fa91321763d..288e90aff461 100644 --- a/sbin/devd/devd.cc +++ b/sbin/devd/devd.cc @@ -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);