diff options
author | Vicent Martà <vicent@github.com> | 2013-06-05 09:16:19 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-06-05 09:16:19 -0700 |
commit | e236b37ff75e20f7259508ed022e67fe38458fea (patch) | |
tree | 99f7360e2541ab7c76b85f41a5a51acbf724c843 | |
parent | 947fad4f7f7fbbc6d624570e9186326d3beb8cce (diff) | |
parent | daf98cb2edaa2d8b45c3e88d2d2f4c5db7925b2f (diff) | |
download | libgit2-e236b37ff75e20f7259508ed022e67fe38458fea.tar.gz |
Merge pull request #1633 from jamill/directory_create_fix
Allow creation of directories under the volume root in Win32
-rw-r--r-- | src/fileops.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/fileops.c b/src/fileops.c index a3e43214f..a4f56e0db 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -277,7 +277,7 @@ int git_futils_mkdir( mode_t mode, uint32_t flags) { - int error = -1; + int error = -1, tmp_errno; git_buf make_path = GIT_BUF_INIT; ssize_t root = 0; char lastch, *tail; @@ -345,18 +345,26 @@ int git_futils_mkdir( already_exists = 1; break; +#ifdef GIT_WIN32 + case EACCES: +#endif case ENOSYS: - /* Solaris can generate this error if you try to mkdir - * a path which is already a mount point. In that case, - * the path does already exist; but it's not implied by + /* The following errors can be generated if: + * EACCES - Win32 can generate this error if you try to mkdir + * a path which is the root of a volume. + * ENOSYS - Solaris can generate a ENOSYS error if you try to mkdir + * a path which is already a mount point. + * In these cases, the path does already exist; but it's not implied by * the definition of the error, so let's recheck */ + tmp_errno = errno; + if (git_path_isdir(make_path.ptr)) { already_exists = 1; break; } /* Fall through */ - errno = ENOSYS; + errno = tmp_errno; default: giterr_set(GITERR_OS, "Failed to make directory '%s'", make_path.ptr); |