X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_tarExtract;h=c18dc9550e97e1d08c81d62b74ef10637db41b4c;hp=5c10cace3c48f33f7da59f826b88c93fa752fce5;hb=1a2fa2c2a1e0db12dc788216d9f3ba73301a131f;hpb=ce708288691ba7dd95a8dac7a468bc0e4c1d6588 diff --git a/bin/BackupPC_tarExtract b/bin/BackupPC_tarExtract index 5c10cac..c18dc95 100755 --- a/bin/BackupPC_tarExtract +++ b/bin/BackupPC_tarExtract @@ -27,7 +27,7 @@ # #======================================================================== # -# Version 2.1.0beta0, released 20 Mar 2004. +# Version 2.1.0beta1, released 9 Apr 2004. # # See http://backuppc.sourceforge.net. # @@ -115,6 +115,7 @@ my $ExistFileSize = 0; my $ExistFileCompSize = 0; my $TotalFileCnt = 0; my $TotalFileSize = 0; +my $TarReadHdrCnt = 0; sub TarRead { @@ -128,6 +129,7 @@ sub TarRead substr($data, $numBytes, $totBytes - $numBytes), $totBytes - $numBytes); if ( $newBytes <= 0 ) { + return if ( $TarReadHdrCnt == 1 ); # empty tar file ok print("Unexpected end of tar archive (tot = $totBytes," . " num = $numBytes, posn = " . sysseek($fh, 0, 1) . ")\n"); $Abort = 1; @@ -144,6 +146,7 @@ sub TarReadHeader { my($fh) = @_; + $TarReadHdrCnt++; return $1 if ( TarRead($fh, $tar_header_length) =~ /(.*)/s ); return; } @@ -423,26 +426,30 @@ sub attributeWrite my $poolWrite = BackupPC::PoolWrite->new($bpc, $fileName, length($data), $Compress); $poolWrite->write(\$data); - processClose($poolWrite, $Attrib{$d}->fileName($d), length($data)); + processClose($poolWrite, $Attrib{$d}->fileName($d), length($data), 1); } delete($Attrib{$d}); } sub processClose { - my($poolWrite, $fileName, $origSize) = @_; + my($poolWrite, $fileName, $origSize, $noStats) = @_; my($exists, $digest, $outSize, $errs) = $poolWrite->close; if ( @$errs ) { print(join("", @$errs)); $Errors += @$errs; } - $TotalFileCnt++; - $TotalFileSize += $origSize; + if ( !$noStats ) { + $TotalFileCnt++; + $TotalFileSize += $origSize; + } if ( $exists ) { - $ExistFileCnt++; - $ExistFileSize += $origSize; - $ExistFileCompSize += $outSize; + if ( !$noStats ) { + $ExistFileCnt++; + $ExistFileSize += $origSize; + $ExistFileCompSize += $outSize; + } } elsif ( $outSize > 0 ) { print(NEW_FILES "$digest $origSize $fileName\n"); }