[libbdplus-devel] Handle fseek error

anonymous git at videolan.org
Thu Mar 16 11:41:18 CET 2017


libbdplus | branch: master | anonymous <anonymous at anonymous.org> | Thu Mar 16 12:14:10 2017 +0200| [4d73f4222ddae322bfc7bdb4e3ae8196977a6f95] | committer: anonymous

Handle fseek error

> http://git.videolan.org/gitweb.cgi/libbdplus.git/?a=commit;h=4d73f4222ddae322bfc7bdb4e3ae8196977a6f95
---

 src/libbdplus/bdsvm/diff.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libbdplus/bdsvm/diff.c b/src/libbdplus/bdsvm/diff.c
index 9def5b0..c33276a 100644
--- a/src/libbdplus/bdsvm/diff.c
+++ b/src/libbdplus/bdsvm/diff.c
@@ -223,7 +223,10 @@ uint32_t diff_hashdb_load(uint8_t *hashname, uint8_t *fname, uint64_t offset,
 
         // Seek past this entry, "next" number of bytes from "next" position,
         // but we read "next" AND "len".
-        fseek(fd, sha_hdr.next - sizeof(sha_hdr.len), SEEK_CUR);
+        if (fseek(fd, sha_hdr.next - sizeof(sha_hdr.len), SEEK_CUR) < 0) {
+          BD_DEBUG(DBG_BDPLUS,"[diff] Seek to next hash_db.bin failed\n");
+          break;
+        }
 
     } // while fread
 



More information about the libbdplus-devel mailing list