Skip to content

Commit

Permalink
rerere: don't segfault on failure to open rr-cache
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
peff authored and gitster committed Dec 4, 2009
1 parent adf9628 commit e5f5917
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-rerere.c
Expand Up @@ -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;
Expand Down

0 comments on commit e5f5917

Please sign in to comment.