mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
vl.c: move pidfile creation up the line
With current code, pid file is open after various sockets, chardevs, fsdevs and the like. This causes interesting effects, for example when monitor is a unix-socket, and another qemu instance is already running, new qemu first "damages" the socket and next complain that it can't acquire the pid file and exits, making running qemu unreachable. Move pid file creation earlier, right after the call to os_daemonize(), where we know our process id (pid). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-Id: <1478096330-18081-1-git-send-email-mjt@msgid.tls.msk.ru> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f5c052b973
commit
004c8e0090
1 changed files with 5 additions and 5 deletions
10
vl.c
10
vl.c
|
|
@ -4063,6 +4063,11 @@ int main(int argc, char **argv, char **envp)
|
||||||
|
|
||||||
os_daemonize();
|
os_daemonize();
|
||||||
|
|
||||||
|
if (pid_file && qemu_create_pidfile(pid_file) != 0) {
|
||||||
|
error_report("could not acquire pid file: %s", strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (qemu_init_main_loop(&main_loop_err)) {
|
if (qemu_init_main_loop(&main_loop_err)) {
|
||||||
error_report_err(main_loop_err);
|
error_report_err(main_loop_err);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
@ -4340,11 +4345,6 @@ int main(int argc, char **argv, char **envp)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pid_file && qemu_create_pidfile(pid_file) != 0) {
|
|
||||||
error_report("could not acquire pid file: %s", strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qemu_opts_foreach(qemu_find_opts("device"),
|
if (qemu_opts_foreach(qemu_find_opts("device"),
|
||||||
device_help_func, NULL, NULL)) {
|
device_help_func, NULL, NULL)) {
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue