aboutsummaryrefslogtreecommitdiffstats
path: root/Packdrakeng.pm
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2005-01-03 16:38:40 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2005-01-03 16:38:40 +0000
commitd4f28b53147fa97f0f4feddf861804f6d9a8afed (patch)
tree826c53c61aa3266af16f16d6e297838c10b611b6 /Packdrakeng.pm
parent068bd6155c75fdbc0b88846a9717fa52624dce7a (diff)
downloadrpmtools-d4f28b53147fa97f0f4feddf861804f6d9a8afed.tar
rpmtools-d4f28b53147fa97f0f4feddf861804f6d9a8afed.tar.gz
rpmtools-d4f28b53147fa97f0f4feddf861804f6d9a8afed.tar.bz2
rpmtools-d4f28b53147fa97f0f4feddf861804f6d9a8afed.tar.xz
rpmtools-d4f28b53147fa97f0f4feddf861804f6d9a8afed.zip
- fix data read detection when using cache
Diffstat (limited to 'Packdrakeng.pm')
-rw-r--r--Packdrakeng.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/Packdrakeng.pm b/Packdrakeng.pm
index e822dad..86e3942 100644
--- a/Packdrakeng.pm
+++ b/Packdrakeng.pm
@@ -410,7 +410,7 @@ sub extern_uncompress {
while ($byteswritten < $fileinfo->{size}) {
my $data = $pack->{ustream_data}{buf};
$pack->{ustream_data}{buf} = undef;
- my $length = 0;
+ my $length;
if (!defined($data)) {
$length = sysread($pack->{ustream_data}{handle}, $data, $pack->{bufsize}) or do {
$pack->{log}("Unexpected end of stream $pack->{ustream_data}{tempname}");
@@ -419,6 +419,8 @@ sub extern_uncompress {
$pack->{ustream_data} = undef;
return -1;
};
+ } else {
+ $length = length($data);
}
if ($pack->{ustream_data}{read} < $fileinfo->{off} && $pack->{ustream_data}{read} + $length > $fileinfo->{off}) {
@@ -431,6 +433,7 @@ sub extern_uncompress {
if ($byteswritten + length($data) > $fileinfo->{size}) {
$bw = $fileinfo->{size} - $byteswritten;
$pack->{ustream_data}{buf} = substr($data, $bw); # keeping track of unwritten uncompressed data
+ $pack->{ustream_data}{read} -= length($pack->{ustream_data}{buf});
} else {
$bw = length($data);
}