#
#========================================================================
#
-# Version 2.0.0_CVS, released 18 Jan 2003.
+# Version 2.0.0_CVS, released 3 Feb 2003.
#
# See http://backuppc.sourceforge.net.
#
} else {
delete($fio->{csumDigest});
}
- alarm($fio->{timeout}) if ( defined($fio->{timeout}) );
}
sub csumGet
return;
}
$fio->log("$f->{name}: opened for read") if ( $fio->{logLevel} >= 4 );
- alarm($fio->{timeout}) if ( defined($fio->{timeout}) );
}
sub read
my $poolWrite = BackupPC::PoolWrite->new($fio->{bpc}, $fileName,
length($data), $fio->{xfer}{compress});
$poolWrite->write(\$data);
- $fio->processClose($poolWrite, $fio->{attrib}{$d}->fileName($d),
+ $fio->processClose($poolWrite, $fio->{attrib}{$d}->fileName($dirM),
length($data), 0);
}
delete($fio->{attrib}{$d});
$fio->{rxRemainder} = $remainder; # size of the last block
$fio->{rxMatchBlk} = 0; # current start of match
$fio->{rxMatchNext} = 0; # current next block of match
- my $rxSize = ($cnt - 1) * $size + $remainder;
+ $fio->{rxSize} = 0; # size of received file
+ my $rxSize = $cnt > 0 ? ($cnt - 1) * $size + $remainder : 0;
if ( $fio->{rxFile}{size} != $rxSize ) {
$fio->{rxMatchBlk} = undef; # size different, so no file match
$fio->log("$fio->{rxFile}{name}: size doesn't match"
delete($fio->{rxOutFd});
delete($fio->{rxDigest});
delete($fio->{rxInData});
- alarm($fio->{timeout}) if ( defined($fio->{timeout}) );
}
#
#
unlink("$fio->{outDirSh}RStmp")
if ( -f "$fio->{outDirSh}RStmp" );
- if ( open(F, ">+", "$fio->{outDirSh}RStmp") ) {
+ if ( open(F, "+>", "$fio->{outDirSh}RStmp") ) {
my $data;
while ( $fh->read(\$data, 1024 * 1024) > 0 ) {
if ( syswrite(F, $data) != length($data) ) {
}
$fio->{rxOutFd}->write(\$data);
$fio->{rxDigest}->add($data);
+ $fio->{rxSize} += length($data);
}
$fio->{rxMatchBlk} = undef;
}
if ( $fio->{logLevel} >= 10 );
$fio->{rxOutFd}->write(\$newData);
$fio->{rxDigest}->add($newData);
+ $fio->{rxSize} += length($newData);
}
}
my $data;
while ( $fh->read(\$data, 4 * 65536) > 0 ) {
$fio->{rxDigest}->add($data);
+ $fio->{rxSize} += length($data);
}
$fh->close;
} else {
# One special case is an empty file: if the file size is
# zero we need to open the output file to create it.
#
- if ( $fio->{rxFile}{size} == 0 ) {
+ if ( $fio->{rxSize} == 0 ) {
my $rxOutFileRel = "$fio->{shareM}/"
. $fio->{bpc}->fileNameMangle($name);
my $rxOutFile = $fio->{outDir} . $rxOutFileRel;
$fio->{rxOutFd} = BackupPC::PoolWrite->new($fio->{bpc},
- $rxOutFile, $fio->{rxFile}{size},
+ $rxOutFile, $fio->{rxSize},
$fio->{xfer}{compress});
}
if ( !defined($fio->{rxOutFd}) ) {
# Cumulate the stats
#
$fio->{stats}{TotalFileCnt}++;
- $fio->{stats}{TotalFileSize} += $fio->{rxFile}{size};
+ $fio->{stats}{TotalFileSize} += $fio->{rxSize};
$fio->{stats}{ExistFileCnt}++;
- $fio->{stats}{ExistFileSize} += $fio->{rxFile}{size};
+ $fio->{stats}{ExistFileSize} += $fio->{rxSize};
$fio->{stats}{ExistFileCompSize} += -s $rxOutFile;
- return;
+ $fio->{rxFile}{size} = $fio->{rxSize};
+ return $fio->attribSet($fio->{rxFile});
}
}
if ( defined($fio->{rxOutFd}) ) {
my $exist = $fio->processClose($fio->{rxOutFd},
$fio->{rxOutFileRel},
- $fio->{rxFile}{size}, 1);
+ $fio->{rxSize}, 1);
$fio->logFileAction($exist ? "pool" : "create", $fio->{rxFile})
if ( $fio->{logLevel} >= 1 );
+ $fio->{rxFile}{size} = $fio->{rxSize};
+ return $fio->attribSet($fio->{rxFile});
}
delete($fio->{rxDigest});
delete($fio->{rxInData});
$fio->{stats}{TotalFileCnt}++;
$fio->{stats}{TotalFileSize} += $a->{size};
}
- alarm($fio->{timeout}) if ( defined($fio->{timeout}) );
}
sub fileListSend
# Flush the attributes if this is the child
#
$fio->attribWrite(undef);
- alarm($fio->{timeout}) if ( defined($fio->{timeout}) );
}
#sub is_tainted