diff options
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c index 40da87ea71..51686518e0 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2309,8 +2309,11 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile, if (ce_flush(&c, newfd, istate->sha1)) return -1; - if (close_tempfile(tempfile)) - return error(_("could not close '%s'"), tempfile->filename.buf); + if (close_tempfile_gently(tempfile)) { + error(_("could not close '%s'"), tempfile->filename.buf); + delete_tempfile(tempfile); + return -1; + } if (stat(tempfile->filename.buf, &st)) return -1; istate->timestamp.sec = (unsigned int)st.st_mtime; |