summaryrefslogtreecommitdiff
path: root/builtin-rerere.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2009-12-04 05:35:57 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-12-04 09:11:58 -0800
commite5f591720caea0c6645fa9852903a1c43d7c3672 (patch)
tree7352a44fb07df276c63149be7ee5c051ffbac4b4 /builtin-rerere.c
parentPrepare for 1.6.5.5 (diff)
downloadtgif-e5f591720caea0c6645fa9852903a1c43d7c3672.tar.xz
rerere: don't segfault on failure to open rr-cache
The rr-cache directory should always exist if we are doing garbage collection (earlier code paths check this explicitly), but we may not necessarily succeed in opening it (for example, due to permissions problems). In that case, we should print an error message rather than simply segfaulting. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-rerere.c')
-rw-r--r--builtin-rerere.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-rerere.c b/builtin-rerere.c
index adfb7b5f48..31fda73ae7 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -48,6 +48,8 @@ static void garbage_collect(struct string_list *rr)
git_config(git_rerere_gc_config, NULL);
dir = opendir(git_path("rr-cache"));
+ if (!dir)
+ die_errno("unable to open rr-cache directory");
while ((e = readdir(dir))) {
if (is_dot_or_dotdot(e->d_name))
continue;