num startTime endTime result errorMsg nFiles size
tarCreateErrs xferErrs
)],
+ ArchiveFields => [qw(
+ num startTime endTime result errorMsg
+ )],
}, $class;
$bpc->{BinDir} .= "/bin";
$bpc->{LibDir} .= "/lib";
close(LOCK);
}
+sub ArchiveInfoRead
+{
+ my($bpc, $host) = @_;
+ local(*ARCHIVE_INFO, *LOCK);
+ my(@Archives);
+
+ flock(LOCK, LOCK_EX) if open(LOCK, "$bpc->{TopDir}/pc/$host/LOCK");
+ if ( open(ARCHIVE_INFO, "$bpc->{TopDir}/pc/$host/archives") ) {
+ binmode(ARCHIVE_INFO);
+ while ( <ARCHIVE_INFO> ) {
+ s/[\n\r]+//;
+ next if ( !/^(\d+.*)/ );
+ $_ = $1;
+ @{$Archives[@Archives]}{@{$bpc->{ArchiveFields}}} = split(/\t/);
+ }
+ close(ARCHIVE_INFO);
+ }
+ close(LOCK);
+ return @Archives;
+}
+
+sub ArchiveInfoWrite
+{
+ my($bpc, $host, @Archives) = @_;
+ local(*ARCHIVE_INFO, *LOCK);
+ my($i);
+
+ flock(LOCK, LOCK_EX) if open(LOCK, "$bpc->{TopDir}/pc/$host/LOCK");
+ unlink("$bpc->{TopDir}/pc/$host/archives.old")
+ if ( -f "$bpc->{TopDir}/pc/$host/archives.old" );
+ rename("$bpc->{TopDir}/pc/$host/archives",
+ "$bpc->{TopDir}/pc/$host/archives.old")
+ if ( -f "$bpc->{TopDir}/pc/$host/archives" );
+ if ( open(ARCHIVE_INFO, ">$bpc->{TopDir}/pc/$host/archives") ) {
+ binmode(ARCHIVE_INFO);
+ for ( $i = 0 ; $i < @Archives ; $i++ ) {
+ my %b = %{$Archives[$i]};
+ printf(ARCHIVE_INFO "%s\n",
+ join("\t", @b{@{$bpc->{ArchiveFields}}}));
+ }
+ close(ARCHIVE_INFO);
+ }
+ close(LOCK);
+}
+
sub ConfigRead
{
my($bpc, $host) = @_;
return -2 if ( !defined($rawFile = $bpc->MD52Path($d, $compress)) );
$rawFile .= "_$i" if ( $i >= 0 );
if ( -f $rawFile ) {
- if ( !compare($name, $rawFile) ) {
+ if ( (stat(_))[3] < $bpc->{Conf}{HardLinkMax}
+ && !compare($name, $rawFile) ) {
unlink($name);
return -3 if ( !link($rawFile, $name) );
return 1;