From 02f03b7fd6d06fce85e5337b17b6778951bac971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 25 Jul 2015 17:49:20 +0200 Subject: path: convert diropen's ENOENT to GIT_ENOTFOUND If a directory is removed between the listing of its parent and the attempt to traverse it, we need to indicate that through our error code so the caller knows to continue. --- src/path.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/path.c b/src/path.c index 2558058dd..c8f674c74 100644 --- a/src/path.c +++ b/src/path.c @@ -1260,10 +1260,15 @@ int git_path_diriter_init( } if ((diriter->dir = opendir(diriter->path.ptr)) == NULL) { + int error = -1; + git_buf_free(&diriter->path); + if (errno == ENOENT) + error = GIT_ENOTFOUND; + giterr_set(GITERR_OS, "Failed to open directory '%s'", path); - return -1; + return error; } #ifdef GIT_USE_ICONV -- cgit v1.2.1