From: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> A follow-up to the recently fixed bugs in the untracked invalidation. If opendir() fails it should show a warning, perhaps this should die, but if this ever happens the error is probably recoverable for the user, and dying would just make things worse. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- dir.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dir.c b/dir.c index 163ca69df0..a605e01692 100644 --- a/dir.c +++ b/dir.c @@ -1857,17 +1857,22 @@ static int open_cached_dir(struct cached_dir *cdir, struct strbuf *path, int check_only) { + const char *c_path; + memset(cdir, 0, sizeof(*cdir)); cdir->untracked = untracked; if (valid_cached_dir(dir, untracked, istate, path, check_only)) return 0; - cdir->fdir = opendir(path->len ? path->buf : "."); + c_path = path->len ? path->buf : "."; + cdir->fdir = opendir(c_path); if (dir->untracked) { invalidate_directory(dir->untracked, untracked); dir->untracked->dir_opened++; } - if (!cdir->fdir) + if (!cdir->fdir) { + warning_errno(_("could not open directory '%s'"), c_path); return -1; + } return 0; } -- 2.15.1.424.g9478a66081