@matheusbsbs / matheus-bagliano / commits / e5f591720c
Fork 0

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>

Jeff King committed Dec 4, 2009 at 05:35 UTC e5f591720caea0c6645fa9852903a1c43d7c3672
1 file changed +2
builtin-rerere.c
+2
@@ -48,6 +48,8 @@ static void garbage_collect(struct string_list *rr)
48
49 git_config(git_rerere_gc_config, NULL);
50 dir = opendir(git_path("rr-cache"));
51 + if (!dir)
52 + die_errno("unable to open rr-cache directory");
53 while ((e = readdir(dir))) {
54 if (is_dot_or_dotdot(e->d_name))
55 continue;