Commit 68bdcdc2f5d3c37d918f85368c2537a8aa7d90eb

Stefan Sperling 2021-06-11T17:10:50

addblk() may seek in its input file; reposition the file pointer afterwards

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/deltify.c b/lib/deltify.c
index a458b91..45add00 100644
--- a/lib/deltify.c
+++ b/lib/deltify.c
@@ -268,6 +268,8 @@ got_deltify_init(struct got_delta_table **dt, FILE *f, off_t fileoffset,
 		if (err)
 			goto done;
 		fileoffset += blocklen;
+		if (fseeko(f, fileoffset, SEEK_SET) == -1)
+			return got_error_from_errno("fseeko");
 	}
 done:
 	if (err) {