File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -965,20 +965,22 @@ sub cat_blob {
965
965
my $size = $1 ;
966
966
967
967
my $blob ;
968
- my $bytesRead = 0 ;
968
+ my $bytesLeft = $size ;
969
969
970
970
while (1) {
971
- my $bytesLeft = $size - $bytesRead ;
972
971
last unless $bytesLeft ;
973
972
974
973
my $bytesToRead = $bytesLeft < 1024 ? $bytesLeft : 1024;
975
- my $read = read ($in , $blob , $bytesToRead , $bytesRead );
974
+ my $read = read ($in , $blob , $bytesToRead );
976
975
unless (defined ($read )) {
977
976
$self -> _close_cat_blob();
978
977
throw Error::Simple(" in pipe went bad" );
979
978
}
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 ;
982
984
}
983
985
984
986
# Skip past the trailing newline.
@@ -993,11 +995,6 @@ sub cat_blob {
993
995
throw Error::Simple(" didn't find newline after blob" );
994
996
}
995
997
996
- unless (print $fh $blob ) {
997
- $self -> _close_cat_blob();
998
- throw Error::Simple(" couldn't write to passed in filehandle" );
999
- }
1000
-
1001
998
return $size ;
1002
999
}
1003
1000
You can’t perform that action at this time.
0 commit comments