]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch
bump version to 7.1.0-4
[pve-qemu.git] / debian / patches / extra / 0005-init-daemonize-defuse-PID-file-resolve-error.patch
CommitLineData
509409fb
TL
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Fiona Ebner <f.ebner@proxmox.com>
3Date: Fri, 28 Oct 2022 10:09:46 +0200
4Subject: [PATCH] init: daemonize: defuse PID file resolve error
5
6When proxmox-file-restore invokes QEMU, the PID file is a (temporary)
7file that's already unlinked, so resolving the absolute path here
8failed.
9
10It should not be a critical error when the PID file unlink handler
11can't be registered, because the path can't be resolved for whatever
12reason. If the file is already gone from QEMU's perspective (i.e.
13errno is ENOENT), silently ignore the error. Otherwise, print a
14warning.
15
16Reported-by: Dominik Csapak <d.csapak@proxmox.com>
17Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
19---
20 softmmu/vl.c | 9 +++++----
21 1 file changed, 5 insertions(+), 4 deletions(-)
22
23diff --git a/softmmu/vl.c b/softmmu/vl.c
24index 706bd7cff7..3381c56af7 100644
25--- a/softmmu/vl.c
26+++ b/softmmu/vl.c
27@@ -2438,10 +2438,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) {