summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-10-08 21:46:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-15 20:08:11 (GMT)
commitae22e8415d5ec2b52a4c83e181297ac15aeaced0 (patch)
tree02151eb52b59cfd8f816743f1f4fcd24971c7360 /midx.c
parentc0f1f9dec4457ffecf9e087665e6eb28da19c18f (diff)
downloadgit-ae22e8415d5ec2b52a4c83e181297ac15aeaced0.zip
git-ae22e8415d5ec2b52a4c83e181297ac15aeaced0.tar.gz
git-ae22e8415d5ec2b52a4c83e181297ac15aeaced0.tar.bz2
midx.c: guard against commit_lock_file() failures
When writing a MIDX, we atomically move the new MIDX into place via commit_lock_file(), but do not check to see if that call was successful. Make sure that we do check in order to prevent us from incorrectly reporting that we wrote a new MIDX if we actually encountered an error. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index f2c9760..8433086 100644
--- a/midx.c
+++ b/midx.c
@@ -1423,7 +1423,8 @@ static int write_midx_internal(const char *object_dir,
if (ctx.m)
close_object_store(the_repository->objects);
- commit_lock_file(&lk);
+ if (commit_lock_file(&lk) < 0)
+ die_errno(_("could not write multi-pack-index"));
clear_midx_files_ext(object_dir, ".bitmap", midx_hash);
clear_midx_files_ext(object_dir, ".rev", midx_hash);