Commit 6845d2847706fc21a9a908825e35495ee75ac5e8

Stefan Sperling 2018-03-16T21:40:20

use SEEK_SET instead of SEEK_CUR after opening packfile

diff --git a/lib/pack.c b/lib/pack.c
index 2679f50..5a8a695 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -989,7 +989,7 @@ get_delta_sizes(uint64_t *base_size, uint64_t *result_size,
 	if (delta_file == NULL)
 		return got_error_from_errno();
 
-	if (fseeko(delta_file, delta->data_offset, SEEK_CUR) != 0) {
+	if (fseeko(delta_file, delta->data_offset, SEEK_SET) != 0) {
 		err = got_error_from_errno();
 		fclose(delta_file);
 		return err;
@@ -1242,7 +1242,7 @@ dump_delta_chain_to_file(struct got_delta_chain *deltas, FILE *outfile,
 				err = got_error_from_errno();
 				goto done;
 			}
-			if (fseeko(delta_file, delta->data_offset, SEEK_CUR)
+			if (fseeko(delta_file, delta->data_offset, SEEK_SET)
 			    != 0) {
 				fclose(delta_file);
 				err = got_error_from_errno();
@@ -1388,7 +1388,7 @@ dump_delta_chain_to_mem(uint8_t **outbuf, size_t *outlen,
 				err = got_error_from_errno();
 				goto done;
 			}
-			if (fseeko(delta_file, delta->data_offset, SEEK_CUR)
+			if (fseeko(delta_file, delta->data_offset, SEEK_SET)
 			    != 0) {
 				fclose(delta_file);
 				err = got_error_from_errno();