summaryrefslogtreecommitdiff
path: root/builtin/prune.c
diff options
context:
space:
mode:
authorKarsten Blees <karsten.blees@dcon.de>2012-03-06 09:18:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-03-07 18:24:33 (GMT)
commitd34e70d6b89b33c398403e872c0dd751d44c7844 (patch)
treeb674f854d00d2145951d93076eb5f5c426d8de24 /builtin/prune.c
parent0dbe6592ccbd1a394a69a52074e3729d546fe952 (diff)
downloadgit-d34e70d6b89b33c398403e872c0dd751d44c7844.zip
git-d34e70d6b89b33c398403e872c0dd751d44c7844.tar.gz
git-d34e70d6b89b33c398403e872c0dd751d44c7844.tar.bz2
fix deletion of .git/objects sub-directories in git-prune/repack
Both git-prune and git-repack (and thus, git-gc) try to rmdir while holding a DIR* handle on the directory. This can leave dangling empty directories in the .git/objects on platforms where directory cannot be removed while they are open. First call closedir() and then rmdir(); that is more logical ordering. Reported-by: John Chen <john0312@gmail.com> Reported-by: Stefan Naewe <stefan.naewe@gmail.com> Signed-off-by: Karsten Blees <blees@dcon.de> Improved-and-Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/prune.c')
-rw-r--r--builtin/prune.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/prune.c b/builtin/prune.c
index 58d7cb8..b99b635 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -85,9 +85,9 @@ static int prune_dir(int i, char *path)
}
fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name);
}
+ closedir(dir);
if (!show_only)
rmdir(path);
- closedir(dir);
return 0;
}