libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 1587002af7f1c60db280b10a5e98bc636d226977
parent 75eecc0124a1b913308117f286cfcf68b831c148
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 23 Aug 2012 22:22:03 +0000

fix exiv2 -- does not like partial reads

Diffstat:
Msrc/plugins/exiv2_extractor.cc | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/plugins/exiv2_extractor.cc b/src/plugins/exiv2_extractor.cc @@ -283,11 +283,17 @@ ExtractorIO::read (Exiv2::byte *buf, { void *data; ssize_t ret; - - if (-1 == (ret = ec->read (ec->cls, &data, rcount))) - return 0; - memcpy (buf, data, ret); - return ret; + long got; + + got = 0; + while (got < rcount) + { + if (-1 == (ret = ec->read (ec->cls, &data, rcount - got))) + return got; + memcpy (&buf[got], data, ret); + got += ret; + } + return got; }