Commit 3bfc233445b0e31daeeebe0e0a98bf346af7be03

Stefan Sperling 2022-01-11T15:37:06

fix file corruption regression in 'got checkout' caused by commit db696021 got-read-pack must rewind its files temporary files before reusing them. Problem reported by naddy ok tracey naddy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/pack.c b/lib/pack.c
index 4a1a3b5..d023ca6 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -1123,6 +1123,11 @@ got_pack_dump_delta_chain_to_file(size_t *result_size,
 			return got_error_from_errno("malloc");
 		base_file = NULL;
 		accum_file = NULL;
+	} else {
+		if (fseeko(base_file, 0L, SEEK_SET) == -1)
+			return got_error_from_errno("fseeko");
+		if (fseeko(accum_file, 0L, SEEK_SET) == -1)
+			return got_error_from_errno("fseeko");
 	}
 
 	/* Deltas are ordered in ascending order. */