Commit Diff


commit - a85917112992dbff7d0827f6cf65c6b5a3fb7bd2
commit + aa51f4a4acac901a4f1bf4062664644ce95d3e8c
blob - e27b25b4e258ce633b60e16862f79901efaf78d5
blob + 330dc413ad648dbbb4e71369fa0a76eecd197523
--- lib/deltify.c
+++ lib/deltify.c
@@ -315,8 +315,6 @@ stretchblk(FILE *basefile, struct got_delta_block *blo
 {
 	uint8_t basebuf[GOT_DELTIFY_MAXCHUNK], buf[GOT_DELTIFY_MAXCHUNK];
 	size_t base_r, r, i;
-	off_t orig_blocklen = *blocklen;
-	off_t pos = ftello(f);
 	int buf_equal = 1;
 
 	if (fseeko(basefile, block->offset, SEEK_SET) == -1)
@@ -343,9 +341,6 @@ stretchblk(FILE *basefile, struct got_delta_block *blo
 			(*blocklen)++;
 		}
 	}
-
-	if (fseeko(f, pos + *blocklen - orig_blocklen, SEEK_SET) == -1)
-		return got_error_from_errno("fseeko");
 
 	return NULL;
 }
@@ -403,6 +398,9 @@ got_deltify(struct got_delta_instruction **deltas, int
 			    blocklen);
 		}
 		fileoffset += blocklen;
+		if (fseeko(f, fileoffset, SEEK_SET) == -1)
+			return got_error_from_errno("fseeko");
+
 	}
 
 	if (err) {