commit - e11883f02b06fcd5d68da0aa0b781f93b3e94568
commit + d6cf760a654df954418c577a08765155985c095d
blob - 04437057664e089f746308bec4509bd46f5b790e
blob + 361e253cad3dc219aabf23e9274ab69447d1af1e
--- lib/repository.c
+++ lib/repository.c
{
const struct got_error *err = NULL;
struct got_pack *pack = NULL;
+ struct got_pack tmp;
struct stat sb;
size_t i;
}
if (i == repo->pack_cache_size) {
- struct got_pack tmp;
do {
i--;
} while (i > 0 && repo->pinned_pack >= 0 &&
return got_error_from_errno("ftruncate");
if (ftruncate(repo->packs[i].accumfd, 0L) == -1)
return got_error_from_errno("ftruncate");
+ }
+
+ if (i != 0) {
memcpy(&tmp, &repo->packs[i], sizeof(tmp));
memcpy(&repo->packs[i], &repo->packs[0],
sizeof(repo->packs[i]));