summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0dbe659)
raw | patch | inline | side by side (parent: 0dbe659)
author | Karsten Blees <karsten.blees@dcon.de> | |
Tue, 6 Mar 2012 09:18:41 +0000 (10:18 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 7 Mar 2012 18:24:33 +0000 (10:24 -0800) |
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>
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>
builtin/prune-packed.c | patch | blob | history | |
builtin/prune.c | patch | blob | history |
diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c
index f9463deec2f5a5875ee9870e67c990a2fea942db..b58a2e1eb28d0eb94cc6863c64af7e0ac816caea 100644 (file)
--- a/builtin/prune-packed.c
+++ b/builtin/prune-packed.c
unlink_or_warn(pathname);
display_progress(progress, i + 1);
}
- pathname[len] = 0;
- rmdir(pathname);
}
void prune_packed_objects(int opts)
continue;
prune_dir(i, d, pathname, len + 3, opts);
closedir(d);
+ pathname[len + 2] = '\0';
+ rmdir(pathname);
}
stop_progress(&progress);
}
diff --git a/builtin/prune.c b/builtin/prune.c
index 58d7cb83240ecef7ab3ff82f3aa92959ec7a62fe..b99b635e44f6145395b5c761505099c0a0f5b6cc 100644 (file)
--- a/builtin/prune.c
+++ b/builtin/prune.c
}
fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name);
}
+ closedir(dir);
if (!show_only)
rmdir(path);
- closedir(dir);
return 0;
}