X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer%2FTar.pm;h=1de40ff101508ae0636c28ec52fddc50264f82c5;hp=576b5ae257500f640e3a1c123cce7110a319d96e;hb=8f5625f9cdf47f8e04be654c4954838b2df3e26d;hpb=2c14784ad71874ec850d189060fe63d6eb9eba95 diff --git a/lib/BackupPC/Xfer/Tar.pm b/lib/BackupPC/Xfer/Tar.pm index 576b5ae..1de40ff 100644 --- a/lib/BackupPC/Xfer/Tar.pm +++ b/lib/BackupPC/Xfer/Tar.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0_CVS, released 8 Feb 2004. +# Version 2.1.0beta0, released 20 Mar 2004. # # See http://backuppc.sourceforge.net. # @@ -222,17 +222,19 @@ sub readOutput while ( $t->{tarOut} =~ /(.*?)[\n\r]+(.*)/s ) { $_ = $1; $t->{tarOut} = $2; - $t->{XferLOG}->write(\"$_\n"); # # refresh our inactivity alarm # - alarm($conf->{ClientTimeout}); + alarm($conf->{ClientTimeout}) if ( !$t->{abort} ); $t->{lastOutputLine} = $_ if ( !/^$/ ); if ( /^Total bytes written: / ) { + $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 ); $t->{xferOK} = 1; } elsif ( /^\./ ) { + $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 ); $t->{fileCnt}++; } else { + $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{xferErrCnt}++; # # If tar encounters a minor error, it will exit with a non-zero @@ -241,11 +243,34 @@ sub readOutput # $t->{tarBadExitOk} = 1 if ( $t->{xferOK} && /Error exit delayed from previous / ); + # + # Also remember files that had read errors + # + if ( /: \.\/(.*): Read error at byte / ) { + my $badFile = $1; + push(@{$t->{badFiles}}, { + share => $t->{shareName}, + file => $badFile + }); + } + } } return 1; } +sub abort +{ + my($t, $reason) = @_; + my @xferPid = $t->xferPid; + + $t->{abort} = 1; + $t->{abortReason} = $reason; + if ( @xferPid ) { + kill($t->{bpc}->sigName2num("INT"), @xferPid); + } +} + sub setSelectMask { my($t, $FDreadRef) = @_;