5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-25 06:03:52 +03:00

do not overwrite global signal handlers

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.

In all cases the global signal handlers we overwrote were in cli programs or
forked workers, not in daemons.
This commit is contained in:
Emmanuel Kasper 2017-09-14 15:19:39 +02:00 committed by Wolfgang Bumiller
parent d296ed08d3
commit 6cb0144ae3
3 changed files with 23 additions and 13 deletions

View File

@ -2697,7 +2697,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"; };
warn "moving disk with snapshots, snapshots will not be moved!\n"
if $snapshotted;

View File

@ -5622,9 +5622,11 @@ sub restore_vma_archive {
eval {
# enable interrupts
local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = sub {
die "interrupted by signal\n";
};
local $SIG{INT} =
local $SIG{TERM} =
local $SIG{QUIT} =
local $SIG{HUP} =
local $SIG{PIPE} = sub { die "interrupted by signal\n"; };
local $SIG{ALRM} = sub { die "got timeout\n"; };
$oldtimeout = alarm($timeout);
@ -5738,15 +5740,18 @@ sub restore_tar_archive {
my $tmpfn = "$conffile.$$.tmp";
# disable interrupts (always do cleanups)
local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub {
print STDERR "got interrupt - ignored\n";
};
local $SIG{INT} =
local $SIG{TERM} =
local $SIG{QUIT} =
local $SIG{HUP} = sub { print STDERR "got interrupt - ignored\n"; };
eval {
# enable interrupts
local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = sub {
die "interrupted by signal\n";
};
local $SIG{INT} =
local $SIG{TERM} =
local $SIG{QUIT} =
local $SIG{HUP} =
local $SIG{PIPE} = sub { die "interrupted by signal\n"; };
if ($archive eq '-') {
print "extracting archive from STDIN\n";

View File

@ -82,9 +82,11 @@ sub do_import {
eval {
# trap interrupts so we have a chance to clean up
local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = $SIG{PIPE} = sub {
die "interrupted by signal\n";
};
local $SIG{INT} =
local $SIG{TERM} =
local $SIG{QUIT} =
local $SIG{HUP} =
local $SIG{PIPE} = sub { die "interrupted by signal\n"; };
PVE::Storage::activate_volumes($storecfg, [$dst_volid]);
run_command($convert_command);
PVE::Storage::deactivate_volumes($storecfg, [$dst_volid]);