Commit dc7edd429e3aae9d685c43504872d528567f3007

Stefan Sperling 2021-08-22T12:58:34

fix miscalculation of the final pack file size reported by got_pack_create()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/pack_create.c b/lib/pack_create.c
index e18f0ca..73b754d 100644
--- a/lib/pack_create.c
+++ b/lib/pack_create.c
@@ -1257,7 +1257,7 @@ genpack(uint8_t *pack_sha1, FILE *packfile,
 	if (n != SHA1_DIGEST_LENGTH)
 		err = got_ferror(packfile, GOT_ERR_IO);
 	packfile_size += SHA1_DIGEST_LENGTH;
-	packfile_size += 16; /* pack file header */
+	packfile_size += sizeof(struct got_packfile_hdr);
 	err = progress_cb(progress_arg, packfile_size, nours,
 	    nmeta, nmeta, nmeta);
 	if (err)