#
#========================================================================
#
-# Version 2.0.0beta2, released 13 Apr 2003.
+# Version 2.0.0beta3, released 1 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
use BackupPC::Xfer::Smb;
use BackupPC::Xfer::Tar;
use BackupPC::Xfer::Rsync;
+use Socket;
use File::Path;
use Getopt::Std;
$Hosts = $bpc->HostInfoRead($client);
}
if ( !defined($Hosts->{$client}) ) {
- print("Exiting because host $client does not exist in the hosts file\n");
+ print("Exiting because host $client does not exist in the hosts file\n")
+ if ( $opts{v} );
exit(1)
}
# This xfer method outputs a tar format file, so we start a
# BackupPC_tarExtract to extract the data.
#
- # Create a pipe to connect the Xfer method to BackupPC_tarExtract
+ # Create a socketpair to connect the Xfer method to BackupPC_tarExtract
# WH is the write handle for writing, provided to the transport
- # program, and RH is the other end of the pipe for reading,
+ # program, and RH is the other end of the socket for reading,
# provided to BackupPC_tarExtract.
#
- pipe(RH, WH);
+ if ( socketpair(RH, WH, AF_UNIX, SOCK_STREAM, PF_UNSPEC) ) {
+ shutdown(RH, 1); # no writing to this socket
+ shutdown(WH, 0); # no reading from this socket
+ setsockopt(RH, SOL_SOCKET, SO_RCVBUF, 8 * 65536);
+ setsockopt(WH, SOL_SOCKET, SO_SNDBUF, 8 * 65536);
+ } else {
+ #
+ # Default to pipe() if socketpair() doesn't work.
+ #
+ pipe(RH, WH);
+ }
#
# fork a child for BackupPC_tarExtract. TAR is a file handle
# the transfer.
#
if ( my $errMsg = CorrectHostCheck($hostIP, $host) ) {
- $stat{hostError} = $errMsg;
+ $stat{hostError} = $errMsg if ( $stat{hostError} eq "" );
last SCAN;
}
}
my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : "";
#
- # Ignore signals in children
+ # Children quit quietly on ALRM
+ #
+ exit(1) if ( $Pid != $$ && $signame eq "ALRM" );
+
+ #
+ # Ignore other signals in children
#
return if ( $Pid != $$ );