Fixed zombie processes are created when xml transfer is timed out.
(cherry picked from commit 41e6d71159
)
This commit is contained in:
parent
27624a4d70
commit
861a749654
|
@ -824,6 +824,11 @@ sub send_file {
|
||||||
my ($file, $secondary) = @_;
|
my ($file, $secondary) = @_;
|
||||||
my $output;
|
my $output;
|
||||||
|
|
||||||
|
my $pid = fork();
|
||||||
|
return 1 unless defined $pid;
|
||||||
|
|
||||||
|
if ($pid == 0) {
|
||||||
|
# execute the transfer program by child process.
|
||||||
eval {
|
eval {
|
||||||
local $SIG{'ALRM'} = sub {die};
|
local $SIG{'ALRM'} = sub {die};
|
||||||
alarm ($Conf{'transfer_timeout'});
|
alarm ($Conf{'transfer_timeout'});
|
||||||
|
@ -850,14 +855,21 @@ sub send_file {
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$output = "File transfer command is not responding.";
|
log_message ('error', "Error sending file '$file': File transfer command is not responding.");
|
||||||
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the errorlevel
|
# Get the errorlevel
|
||||||
my $rc = $? >> 8;
|
my $rc = $? >> 8;
|
||||||
if ($rc != 0 || $@) {
|
if ($rc != 0) {
|
||||||
log_message ('error', "Error sending file '$file': $output");
|
log_message ('error', "Error sending file '$file': $output");
|
||||||
}
|
}
|
||||||
|
exit $rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait the child process termination and get the errorlevel
|
||||||
|
waitpid ($pid, 0);
|
||||||
|
my $rc = $? >> 8;
|
||||||
|
|
||||||
return $rc unless (defined ($secondary));
|
return $rc unless (defined ($secondary));
|
||||||
|
|
||||||
|
@ -916,6 +928,11 @@ sub recv_file ($) {
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
my $output;
|
my $output;
|
||||||
|
|
||||||
|
my $pid = fork();
|
||||||
|
return 1 unless defined $pid;
|
||||||
|
|
||||||
|
if ($pid == 0) {
|
||||||
|
# execute the transfer program by child process.
|
||||||
eval {
|
eval {
|
||||||
local $SIG{'ALRM'} = sub {die};
|
local $SIG{'ALRM'} = sub {die};
|
||||||
alarm ($Conf{'transfer_timeout'});
|
alarm ($Conf{'transfer_timeout'});
|
||||||
|
@ -942,14 +959,21 @@ sub recv_file ($) {
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$output = "File transfer command is not responding.";
|
log_message ('error', "Error retrieving file: File transfer command is not responding.");
|
||||||
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the errorlevel
|
# Get the errorlevel
|
||||||
my $rc = $? >> 8;
|
my $rc = $? >> 8;
|
||||||
if ($rc != 0 || $@) {
|
if ($rc != 0) {
|
||||||
log_message ('error', "Error retrieving file: $output");
|
log_message ('error', "Error retrieving file: $output");
|
||||||
}
|
}
|
||||||
|
exit $rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait the child process termination and get the errorlevel
|
||||||
|
waitpid ($pid, 0);
|
||||||
|
my $rc = $? >> 8;
|
||||||
|
|
||||||
return $rc;
|
return $rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue