Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2022-01-17 23:20:45 +0300
committerCorinna Vinschen <corinna@vinschen.de>2022-01-18 13:55:44 +0300
commitbd4fdcc0593468237d77035e0f39a0155d17e5bf (patch)
treea04d43a07087200613ebb9798ebbe5c0e2675e95 /winsup
parente195f51af76687d2aebfdd0b24517bd923024b7a (diff)
Cygwin: path_conv: do not get confused by a directory with `.lnk` suffix
When trying to create a directory called `xyz` in the presence of a directory `xyz.lnk`, the Cygwin runtime errors out with an `ENOENT`. The root cause is actually a bit deeper: the `symlink_info::check()` method tries to figure out whether the given path refers to a symbolic link as emulated via `.lnk` files, but since it is a directory, that is not the case, and that hypothesis is rejected. However, the `fileattr` field is not cleared, so that a later `.exists()` call on the instance mistakenly thinks that the symlink actually exists. Let's clear that field. This fixes https://github.com/msys2/msys2-runtime/issues/81 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/path.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 5ab75f105..87ac2404a 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3336,6 +3336,7 @@ restart:
hasn't been found. */
if (ext_tacked_on && !had_ext && (fileattr & FILE_ATTRIBUTE_DIRECTORY))
{
+ fileattr = INVALID_FILE_ATTRIBUTES;
set_error (ENOENT);
continue;
}