提交 bd6b1c83 编写于 作者: M Michal Privoznik 提交者: Paolo Bonzini

qemu-pr-helper: Write pidfile more often

Let's write pidfile even if user did not request --daemon but
they requested just --pidfile. Libvirt will use exactly this.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 8dc0bf26
......@@ -924,6 +924,7 @@ int main(int argc, char **argv)
Error *local_err = NULL;
char *trace_file = NULL;
bool daemonize = false;
bool pidfile_specified = false;
unsigned socket_activation;
struct sigaction sa_sigterm;
......@@ -954,6 +955,7 @@ int main(int argc, char **argv)
case 'f':
g_free(pidfile);
pidfile = g_strdup(optarg);
pidfile_specified = true;
break;
#ifdef CONFIG_LIBCAP
case 'u': {
......@@ -1086,9 +1088,11 @@ int main(int argc, char **argv)
error_report("Failed to daemonize: %s", strerror(errno));
exit(EXIT_FAILURE);
}
write_pidfile();
}
if (daemonize || pidfile_specified)
write_pidfile();
#ifdef CONFIG_LIBCAP
if (drop_privileges() < 0) {
error_report("Failed to drop privileges: %s", strerror(errno));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册