X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer%2FRsyncFileIO.pm;h=d40d51fcf91cf8cf2b1cac5b53a595d66b55dda1;hp=cd0dc82dc7eb401009a346787b65185d29b9420b;hb=74dc9d456332757127d5eda4ce32f29377133fa2;hpb=e4a233559926fe41888b2f6c5cc716401b715162 diff --git a/lib/BackupPC/Xfer/RsyncFileIO.pm b/lib/BackupPC/Xfer/RsyncFileIO.pm index cd0dc82..d40d51f 100644 --- a/lib/BackupPC/Xfer/RsyncFileIO.pm +++ b/lib/BackupPC/Xfer/RsyncFileIO.pm @@ -12,7 +12,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # @@ -968,26 +968,29 @@ sub fileListEltSend || $type == BPC_FTYPE_BLOCKDEV || $type == BPC_FTYPE_SYMLINK ) { my $fh = BackupPC::FileZIO->open($a->{fullPath}, 0, $a->{compress}); - my $str; + my($str, $rdSize); if ( defined($fh) ) { - if ( $fh->read(\$str, $a->{size} + 1) == $a->{size} ) { - if ( $type == BPC_FTYPE_SYMLINK ) { - # - # Reconstruct symbolic link - # - $extraAttribs = { link => $str }; - } elsif ( $str =~ /(\d*),(\d*)/ ) { - # - # Reconstruct char or block special major/minor device num - # - $extraAttribs = { rdev => $1 * 256 + $2 }; - } else { - $fio->log("$name: unexpected special file contents $str"); + $rdSize = $fh->read(\$str, $a->{size} + 1024); + if ( $type == BPC_FTYPE_SYMLINK ) { + # + # Reconstruct symbolic link + # + $extraAttribs = { link => $str }; + if ( $rdSize != $a->{size} ) { + # ERROR + $fio->log("$name: can't read exactly $a->{size} bytes"); $fio->{stats}{errorCnt}++; } + } elsif ( $str =~ /(\d*),(\d*)/ ) { + # + # Reconstruct char or block special major/minor device num + # + # Note: char/block devices have $a->{size} = 0, so we + # can't do an error check on $rdSize. + # + $extraAttribs = { rdev => $1 * 256 + $2 }; } else { - # ERROR - $fio->log("$name: can't read exactly $a->{size} bytes"); + $fio->log("$name: unexpected special file contents $str"); $fio->{stats}{errorCnt}++; } $fh->close;