]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0002-init-daemonize-defuse-PID-file-resolve-error.patch
update submodule and patches to 7.2.0
[pve-qemu.git] / debian / patches / extra / 0002-init-daemonize-defuse-PID-file-resolve-error.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Fiona Ebner <f.ebner@proxmox.com>
3 Date: Fri, 28 Oct 2022 10:09:46 +0200
4 Subject: [PATCH] init: daemonize: defuse PID file resolve error
5
6 When proxmox-file-restore invokes QEMU, the PID file is a (temporary)
7 file that's already unlinked, so resolving the absolute path here
8 failed.
9
10 It should not be a critical error when the PID file unlink handler
11 can't be registered, because the path can't be resolved for whatever
12 reason. If the file is already gone from QEMU's perspective (i.e.
13 errno is ENOENT), silently ignore the error. Otherwise, print a
14 warning.
15
16 Reported-by: Dominik Csapak <d.csapak@proxmox.com>
17 Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
19 ---
20 softmmu/vl.c | 9 +++++----
21 1 file changed, 5 insertions(+), 4 deletions(-)
22
23 diff --git a/softmmu/vl.c b/softmmu/vl.c
24 index 5115221efe..5f7f6ca981 100644
25 --- a/softmmu/vl.c
26 +++ b/softmmu/vl.c
27 @@ -2460,10 +2460,11 @@ static void qemu_maybe_daemonize(const char *pid_file)
28
29 pid_file_realpath = g_malloc0(PATH_MAX);
30 if (!realpath(pid_file, pid_file_realpath)) {
31 - error_report("cannot resolve PID file path: %s: %s",
32 - pid_file, strerror(errno));
33 - unlink(pid_file);
34 - exit(1);
35 + if (errno != ENOENT) {
36 + warn_report("not removing PID file on exit: cannot resolve PID "
37 + "file path: %s: %s", pid_file, strerror(errno));
38 + }
39 + return;
40 }
41
42 qemu_unlink_pidfile_notifier = (struct UnlinkPidfileNotifier) {