提交 b5726b7e 编写于 作者: J John Ferlan

libvirtd: Move pid_file_fd setup to before run_dir

Once we have forked the daemon successfully, let's claim the pidfile
immediately rather than waiting for setup of run_dir.
上级 13f59039
...@@ -1258,6 +1258,12 @@ int main(int argc, char **argv) { ...@@ -1258,6 +1258,12 @@ int main(int argc, char **argv) {
} }
} }
/* Try to claim the pidfile, exiting if we can't */
if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) {
ret = VIR_DAEMON_ERR_PIDFILE;
goto cleanup;
}
/* Ensure the rundir exists (on tmpfs on some systems) */ /* Ensure the rundir exists (on tmpfs on some systems) */
if (privileged) { if (privileged) {
if (VIR_STRDUP_QUIET(run_dir, LOCALSTATEDIR "/run/libvirt") < 0) { if (VIR_STRDUP_QUIET(run_dir, LOCALSTATEDIR "/run/libvirt") < 0) {
...@@ -1286,12 +1292,6 @@ int main(int argc, char **argv) { ...@@ -1286,12 +1292,6 @@ int main(int argc, char **argv) {
} }
umask(old_umask); umask(old_umask);
/* Try to claim the pidfile, exiting if we can't */
if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) {
ret = VIR_DAEMON_ERR_PIDFILE;
goto cleanup;
}
if (virNetlinkStartup() < 0) { if (virNetlinkStartup() < 0) {
ret = VIR_DAEMON_ERR_INIT; ret = VIR_DAEMON_ERR_INIT;
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册