diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-07-25 17:49:20 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-07-25 17:49:20 +0200 |
commit | 02f03b7fd6d06fce85e5337b17b6778951bac971 (patch) | |
tree | 05866d1916ddefdc746fa3a8f342ad3a1f75c72f | |
parent | 42156d561723e92ffe597885719aa63abfe0795c (diff) | |
download | libgit2-cmn/diriter-notfound.tar.gz |
path: convert diropen's ENOENT to GIT_ENOTFOUNDcmn/diriter-notfound
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.
-rw-r--r-- | src/path.c | 7 |
1 files changed, 6 insertions, 1 deletions
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 |