summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-24 09:19:24 -0700
committerRussell Belfer <rb@github.com>2013-06-24 09:19:24 -0700
commit32c12ea6a9cafd76a746af2e2be9366c95752f5b (patch)
treee2efee4e44f8c67c7e9811eff44f0d4f92627745
parent8294e8cfff284a05084f7f9b91931e136a0c119d (diff)
downloadlibgit2-32c12ea6a9cafd76a746af2e2be9366c95752f5b.tar.gz
Work around reparse point stat issues
In theory, p_stat should never return an S_ISLNK result, but due to the current implementation on Windows with mount points it is possible that it will. For now, work around that by allowing a link in the path to a directory being created. If it is really a problem, then the issue will be caught on the next iteration of the loop, but typically this will be the right thing to do.
-rw-r--r--src/fileops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fileops.c b/src/fileops.c
index ae240fcd2..95b15c604 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -348,7 +348,8 @@ int git_futils_mkdir(
int tmp_errno = errno;
/* ignore error if directory already exists */
- if (p_stat(make_path.ptr, &st) < 0 || !S_ISDIR(st.st_mode)) {
+ if (p_stat(make_path.ptr, &st) < 0 ||
+ !(S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))) {
errno = tmp_errno;
giterr_set(GITERR_OS, "Failed to make directory '%s'", make_path.ptr);
goto done;