- parse_options(argc, argv, &file_name, &active, &passive);
+ parse_options(argc, argv, &file_name, &active, &passive, &unixctl_path);
+
+ if (get_detach() && is_chdir_enabled()) {
+ /* We need to skip chdir("/") in daemonize() and do it later, because
+ * we need to open the database and possible set up up Unix domain
+ * sockets in the current working directory after we daemonize. We
+ * can't open the database before we daemonize because file locks
+ * aren't inherited by child processes. */
+ do_chdir = true;
+ set_no_chdir();
+ } else {
+ do_chdir = false;
+ }
+ die_if_already_running();
+ daemonize();