summaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io.c b/src/io.c
index c7846c9..e7ed16e 100644
--- a/src/io.c
+++ b/src/io.c
@@ -295,6 +295,7 @@ static struct apk_bstream *apk_mmap_bstream_from_fd(int fd)
}
mbs->bs = (struct apk_bstream) {
+ .flags = APK_BSTREAM_SINGLE_READ,
.read = mmap_read,
.close = mmap_close,
};
@@ -466,6 +467,8 @@ int apk_file_get_info(const char *filename, int checksum, struct apk_file_info *
apk_blob_t blob;
EVP_DigestInit(&mdctx, apk_get_digest(checksum));
+ if (bs->flags & APK_BSTREAM_SINGLE_READ)
+ EVP_MD_CTX_set_flags(&mdctx, EVP_MD_CTX_FLAG_ONESHOT);
while (!APK_BLOB_IS_NULL(blob = bs->read(bs, APK_BLOB_NULL)))
EVP_DigestUpdate(&mdctx, (void*) blob.ptr, blob.len);
fi->csum.type = EVP_MD_CTX_size(&mdctx);