File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -965,20 +965,22 @@ sub cat_blob {
965965 my $size = $1 ;
966966
967967 my $blob ;
968- my $bytesRead = 0 ;
968+ my $bytesLeft = $size ;
969969
970970 while (1) {
971- my $bytesLeft = $size - $bytesRead ;
972971 last unless $bytesLeft ;
973972
974973 my $bytesToRead = $bytesLeft < 1024 ? $bytesLeft : 1024;
975- my $read = read ($in , $blob , $bytesToRead , $bytesRead );
974+ my $read = read ($in , $blob , $bytesToRead );
976975 unless (defined ($read )) {
977976 $self -> _close_cat_blob();
978977 throw Error::Simple(" in pipe went bad" );
979978 }
980-
981- $bytesRead += $read ;
979+ unless (print $fh $blob ) {
980+ $self -> _close_cat_blob();
981+ throw Error::Simple(" couldn't write to passed in filehandle" );
982+ }
983+ $bytesLeft -= $read ;
982984 }
983985
984986 # Skip past the trailing newline.
@@ -993,11 +995,6 @@ sub cat_blob {
993995 throw Error::Simple(" didn't find newline after blob" );
994996 }
995997
996- unless (print $fh $blob ) {
997- $self -> _close_cat_blob();
998- throw Error::Simple(" couldn't write to passed in filehandle" );
999- }
1000-
1001998 return $size ;
1002999}
10031000
You can’t perform that action at this time.
0 commit comments