mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-14 05:55:40 +00:00
fork_worker: guard more setup code with eval
As it might die with an error which should end up in the _exit() code path rather than bailing out into the upper scope. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
4d9f4d62e4
commit
2311859b0d
@ -561,15 +561,17 @@ sub fork_worker {
|
||||
POSIX::write($psync[1], $upid, length ($upid));
|
||||
POSIX::close($psync[1]) if !$sync; # don't need output pipe if async
|
||||
|
||||
my $readbuf = '';
|
||||
# sync with parent (wait until parent is ready)
|
||||
POSIX::read($csync[0], $readbuf, 4096);
|
||||
die "parent setup error\n" if $readbuf ne 'OK';
|
||||
eval {
|
||||
my $readbuf = '';
|
||||
# sync with parent (wait until parent is ready)
|
||||
POSIX::read($csync[0], $readbuf, 4096);
|
||||
die "parent setup error\n" if $readbuf ne 'OK';
|
||||
|
||||
if ($self->{type} eq 'ha') {
|
||||
print "task started by HA resource agent\n";
|
||||
}
|
||||
eval { &$function($upid); };
|
||||
if ($self->{type} eq 'ha') {
|
||||
print "task started by HA resource agent\n";
|
||||
}
|
||||
&$function($upid);
|
||||
};
|
||||
my $err = $@;
|
||||
if ($err) {
|
||||
chomp $err;
|
||||
|
Loading…
Reference in New Issue
Block a user