forked from msys2/MSYS2-packages
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Git for Windows Build Agent <ci@git-for-windows.build>
- Loading branch information
Git for Windows Build Agent
committed
Jul 3, 2019
1 parent
62987ef
commit 87375a0
Showing
2 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
From e0e7936faa74acea8cde0f89f464402515d1caad Mon Sep 17 00:00:00 2001 | ||
From: Ben Wijen <ben@wijen.net> | ||
Date: Mon, 3 Jun 2019 20:15:50 +0200 | ||
Subject: [PATCH 51/N] mkdir: always check-for-existence | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
When using NtCreateFile when creating a directory that already exists, | ||
it will correctly return 'STATUS_OBJECT_NAME_COLLISION'. | ||
|
||
However using this function to create a directory (and all its parents) | ||
a normal use would be to start with mkdir(â??/cygdrive/câ??) which translates | ||
to â??C:\â?? for which it'll instead return â??STATUS_ACCESS_DENIEDâ??. | ||
--- | ||
winsup/cygwin/dir.cc | 4 +++- | ||
1 file changed, 3 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc | ||
index f43eae4..b757851 100644 | ||
--- a/winsup/cygwin/dir.cc | ||
+++ b/winsup/cygwin/dir.cc | ||
@@ -331,8 +331,10 @@ mkdir (const char *dir, mode_t mode) | ||
debug_printf ("got %d error from build_fh_name", fh->error ()); | ||
set_errno (fh->error ()); | ||
} | ||
+ else if (fh->exists ()) | ||
+ set_errno (EEXIST); | ||
else if (has_dot_last_component (dir, true)) | ||
- set_errno (fh->exists () ? EEXIST : ENOENT); | ||
+ set_errno (ENOENT); | ||
else if (!fh->mkdir (mode)) | ||
res = 0; | ||
delete fh; | ||
-- | ||
2.9.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters