Permalink
Browse files

indexer: close the pack's fd before renaming it

Windows gets upset if we rename a file with an open descriptor.
  • Loading branch information...
1 parent 0f49200 commit a640d79e84b4bf1d3c601f1a8ccf369427005797 @carlosmn carlosmn committed May 9, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/indexer.c
View
@@ -532,6 +532,7 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_indexer_stats *stat
goto on_error;
git_mwindow_free_all(&idx->pack->mwf);
+ p_close(idx->pack->mwf.fd);
if (index_path_stream(&filename, idx, ".pack") < 0)
goto on_error;
@@ -544,6 +545,7 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_indexer_stats *stat
on_error:
git_mwindow_free_all(&idx->pack->mwf);
+ p_close(idx->pack->mwf.fd);
git_filebuf_cleanup(&idx->index_file);
git_buf_free(&filename);
return -1;
@@ -559,7 +561,6 @@ void git_indexer_stream_free(git_indexer_stream *idx)
if (idx == NULL)
return;
- p_close(idx->pack->mwf.fd);
git_vector_foreach(&idx->objects, i, e)
git__free(e);
git_vector_free(&idx->objects);

0 comments on commit a640d79

Please sign in to comment.