From b490237f809cf7593cfa7de0bbb48050e27993a6 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Tue, 11 Jan 2022 15:37:06 +0000 Subject: [PATCH] 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 --- lib/pack.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pack.c b/lib/pack.c index 42db173e..69a1daf4 100644 --- a/lib/pack.c +++ b/lib/pack.c @@ -1119,6 +1119,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. */ -- 2.11.4.GIT