]> git.sur5r.net Git - bacula/bacula/commitdiff
Don't set our PID after we drop privs. Do it before. This fixes bug #923
authorDan Langille <dan@langille.org>
Thu, 16 Aug 2007 18:46:16 +0000 (18:46 +0000)
committerDan Langille <dan@langille.org>
Thu, 16 Aug 2007 18:46:16 +0000 (18:46 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5362 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/dird.c

index 8f596ca73591676cb97314a078bf96519fdcccd7..d34acd8efbbc1cb7b69033d8606160c9db3d88c7 100644 (file)
@@ -228,6 +228,15 @@ int main (int argc, char *argv[])
       Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
    }
 
+   if (background) {
+      daemon_start();
+      init_stack_dump();              /* grab new pid */
+   }
+
+   /* Create pid must come after we are a daemon -- so we have our final pid */
+   create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+   read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+
    drop(uid, gid);                    /* reduce privileges if requested */
 
    if (!check_catalog()) {
@@ -247,15 +256,6 @@ int main (int argc, char *argv[])
    FDConnectTimeout = (int)director->FDConnectTimeout;
    SDConnectTimeout = (int)director->SDConnectTimeout;
 
-   if (background) {
-      daemon_start();
-      init_stack_dump();              /* grab new pid */
-   }
-
-   /* Create pid must come after we are a daemon -- so we have our final pid */
-   create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
-   read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
-
 
 #if !defined(HAVE_WIN32)
    signal(SIGHUP, reload_config);