[pve-devel] [PATCH qemu-server 5/5] restore_vma_archive: do not overwrite global signal handlers

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 6 13:29:07 CEST 2017


perls 'local' must be either used in front of each $SIG{...}
assignments or they must be put in a list, else it affects only the
first variable and the rest are *not* in local context.

This may cause weird behaviour where daemons seemingly do not get
terminating signals delivered correctly and thus may not shutdown
gracefully anymore.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/QemuServer.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2aafc42..b52c93d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5482,9 +5482,10 @@ sub restore_vma_archive {
     rmtree $tmpdir;
 
     # disable interrupts (always do cleanups)
-    local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub {
-	warn "got interrupt - ignored\n";
-    };
+    local $SIG{INT} =
+	local $SIG{TERM} =
+	local $SIG{QUIT} =
+	local $SIG{HUP} = sub { warn "got interrupt - ignored\n"; };
 
     my $mapfifo = "/var/tmp/vzdumptmp$$.fifo";
     POSIX::mkfifo($mapfifo, 0600);
-- 
2.11.0





More information about the pve-devel mailing list