mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-16 02:51:33 +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::write($psync[1], $upid, length ($upid));
|
||||||
POSIX::close($psync[1]) if !$sync; # don't need output pipe if async
|
POSIX::close($psync[1]) if !$sync; # don't need output pipe if async
|
||||||
|
|
||||||
my $readbuf = '';
|
eval {
|
||||||
# sync with parent (wait until parent is ready)
|
my $readbuf = '';
|
||||||
POSIX::read($csync[0], $readbuf, 4096);
|
# sync with parent (wait until parent is ready)
|
||||||
die "parent setup error\n" if $readbuf ne 'OK';
|
POSIX::read($csync[0], $readbuf, 4096);
|
||||||
|
die "parent setup error\n" if $readbuf ne 'OK';
|
||||||
|
|
||||||
if ($self->{type} eq 'ha') {
|
if ($self->{type} eq 'ha') {
|
||||||
print "task started by HA resource agent\n";
|
print "task started by HA resource agent\n";
|
||||||
}
|
}
|
||||||
eval { &$function($upid); };
|
&$function($upid);
|
||||||
|
};
|
||||||
my $err = $@;
|
my $err = $@;
|
||||||
if ($err) {
|
if ($err) {
|
||||||
chomp $err;
|
chomp $err;
|
||||||
|
Loading…
Reference in New Issue
Block a user