[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/6] vl.c: move pidfile creation up the line
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 2/6] vl.c: move pidfile creation up the line |
Date: |
Thu, 10 Nov 2016 18:52:38 +0100 |
From: Michael Tokarev <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
vl.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c
index 319f641..d77dd86 100644
--- a/vl.c
+++ b/vl.c
@@ -4063,6 +4063,11 @@ int main(int argc, char **argv, char **envp)
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)) {
error_report_err(main_loop_err);
exit(1);
@@ -4340,11 +4345,6 @@ int main(int argc, char **argv, char **envp)
}
#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"),
device_help_func, NULL, NULL)) {
exit(0);
--
1.8.3.1
- [Qemu-devel] [PULL 0/6] QEMU patches for 2.8.0-rc0, Paolo Bonzini, 2016/11/10
- [Qemu-devel] [PULL 2/6] vl.c: move pidfile creation up the line,
Paolo Bonzini <=
- [Qemu-devel] [PULL 3/6] target-i386/machine: fix migrate faile because of Hyper-V HV_X64_MSR_VP_RUNTIME, Paolo Bonzini, 2016/11/10
- [Qemu-devel] [PULL 1/6] target-i386: fix typo, Paolo Bonzini, 2016/11/10
- [Qemu-devel] [PULL 4/6] qdev: fix use-after-free regression from becdfa00cfa, Paolo Bonzini, 2016/11/10
- [Qemu-devel] [PULL 6/6] nbd: Don't inf-loop on early EOF, Paolo Bonzini, 2016/11/10
- [Qemu-devel] [PULL 5/6] target-i386: document how x86 gdb_num_core_regs is computed., Paolo Bonzini, 2016/11/10
- Re: [Qemu-devel] [PULL 0/6] QEMU patches for 2.8.0-rc0, Stefan Hajnoczi, 2016/11/11