diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c index a025d6b8aa4e..cb61811246c0 100644 --- a/sbin/hastd/hastd.c +++ b/sbin/hastd/hastd.c @@ -701,8 +701,6 @@ main(int argc, char *argv[]) int debuglevel; sigset_t mask; - g_gate_load(); - foreground = false; debuglevel = 0; pidfile = HASTD_PIDFILE; @@ -736,6 +734,8 @@ main(int argc, char *argv[]) pjdlog_debug_set(debuglevel); + g_gate_load(); + pfh = pidfile_open(pidfile, 0600, &otherpid); if (pfh == NULL) { if (errno == EEXIST) {