mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 20:29:27 +00:00
Merge pull request #1633 from jamill/directory_create_fix
Allow creation of directories under the volume root in Win32
This commit is contained in:
commit
e236b37ff7
@ -277,7 +277,7 @@ int git_futils_mkdir(
|
|||||||
mode_t mode,
|
mode_t mode,
|
||||||
uint32_t flags)
|
uint32_t flags)
|
||||||
{
|
{
|
||||||
int error = -1;
|
int error = -1, tmp_errno;
|
||||||
git_buf make_path = GIT_BUF_INIT;
|
git_buf make_path = GIT_BUF_INIT;
|
||||||
ssize_t root = 0;
|
ssize_t root = 0;
|
||||||
char lastch, *tail;
|
char lastch, *tail;
|
||||||
@ -345,18 +345,26 @@ int git_futils_mkdir(
|
|||||||
|
|
||||||
already_exists = 1;
|
already_exists = 1;
|
||||||
break;
|
break;
|
||||||
|
#ifdef GIT_WIN32
|
||||||
|
case EACCES:
|
||||||
|
#endif
|
||||||
case ENOSYS:
|
case ENOSYS:
|
||||||
/* Solaris can generate this error if you try to mkdir
|
/* The following errors can be generated if:
|
||||||
* a path which is already a mount point. In that case,
|
* EACCES - Win32 can generate this error if you try to mkdir
|
||||||
* the path does already exist; but it's not implied by
|
* 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 */
|
* the definition of the error, so let's recheck */
|
||||||
|
tmp_errno = errno;
|
||||||
|
|
||||||
if (git_path_isdir(make_path.ptr)) {
|
if (git_path_isdir(make_path.ptr)) {
|
||||||
already_exists = 1;
|
already_exists = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
errno = ENOSYS;
|
errno = tmp_errno;
|
||||||
default:
|
default:
|
||||||
giterr_set(GITERR_OS, "Failed to make directory '%s'",
|
giterr_set(GITERR_OS, "Failed to make directory '%s'",
|
||||||
make_path.ptr);
|
make_path.ptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user