[pve-devel] [PATCH container 3/3] API/clone: do not overwrite global signal handlers

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 6 13:29:05 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>
---
 src/PVE/API2/LXC.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 8c3645c..0397224 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1287,7 +1287,10 @@ __PACKAGE__->register_method({
 		my $newvollist = [];
 
 		eval {
-		    local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub { die "interrupted by signal\n"; };
+		    local $SIG{INT} =
+			local $SIG{TERM} =
+			local $SIG{QUIT} =
+			local $SIG{HUP} = sub { die "interrupted by signal\n"; };
 
 		    PVE::Storage::activate_volumes($storecfg, $vollist, $snapname);
 
-- 
2.11.0





More information about the pve-devel mailing list