summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-29 19:06:10 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-29 19:06:10 +0300
commit8cacc96bf034ac40bb702651c939235fe19df824 (patch)
treea089acacb594c792c941a0e2cec30e2c1c1d9230
parent0d9810ea6af939e8b382b39fa1f40fda0811e61d (diff)
downloadapk-tools-8cacc96bf034ac40bb702651c939235fe19df824.tar.gz
apk-tools-8cacc96bf034ac40bb702651c939235fe19df824.tar.bz2
apk-tools-8cacc96bf034ac40bb702651c939235fe19df824.tar.xz
apk-tools-8cacc96bf034ac40bb702651c939235fe19df824.zip
tar: don't call digest finalization twice
otherwise bad things happens. avoid this be checking end of stream at the beginning of read.
-rw-r--r--src/archive.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/archive.c b/src/archive.c
index 4005bf1..68ec287 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -90,6 +90,9 @@ static ssize_t tar_entry_read(void *stream, void *ptr, size_t size)
if (size > teis->bytes_left)
size = teis->bytes_left;
+ if (size == 0)
+ return 0;
+
r = teis->tar_is->read(teis->tar_is, ptr, size);
if (r < 0)
return r;