libbluray | branch: master | hpi1 <[email protected]> | Sun May 15 16:11:58 2016 +0300| [d90bbc27c9eeefdb2a31522e0ad901301459ff6f] | committer: hpi1
disc: fix handling of read errors when caching files > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=d90bbc27c9eeefdb2a31522e0ad901301459ff6f --- src/libbluray/disc/disc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c index b61281e..defa084 100644 --- a/src/libbluray/disc/disc.c +++ b/src/libbluray/disc/disc.c @@ -480,11 +480,9 @@ int disc_cache_bdrom_file(BD_DISC *p, const char *rel_path, const char *cache_pa do { uint8_t buf[16*2048]; got = file_read(fp_in, buf, sizeof(buf)); - if (got < 0) { - /* we'll call write(fp, buf, 0) after EOF. It is used to check for errors. */ - break; - } - if (fp_out->write(fp_out, buf, got) != got) { + + /* we'll call write(fp, buf, 0) after EOF. It is used to check for errors. */ + if (got < 0 || fp_out->write(fp_out, buf, got) != got) { BD_DEBUG(DBG_FILE | DBG_CRIT, "error caching file %s\n", rel_path); file_close(fp_out); file_close(fp_in); _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
