]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: path_conv: do not get confused by a directory with `.lnk` suffix
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 17 Jan 2022 20:20:45 +0000 (21:20 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 18 Jan 2022 10:55:44 +0000 (11:55 +0100)
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>
winsup/cygwin/path.cc

index 5ab75f1055ea7297754653313b593883db655b5f..87ac2404aa928e9a24222ab96b3640f26da958b6 100644 (file)
@@ -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;
        }
This page took 0.037143 seconds and 5 git commands to generate.