Cygwin: open(2): Change comment in disabled O_TMPFILE POSIX unlink code

- Turns out, the definition of POSIX unlink semantics is half-hearted
  so far: It's not possible to link an open file HANDLE if it has
  been deleted with POSIX semantics, nor is it possible to remove
  the delete disposition.  This breaks linkat on an O_TMPFILE.

  Tested with W10 1809.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2018-12-26 21:51:13 +01:00
parent 7148fbc496
commit 07e0a9584f
1 changed files with 12 additions and 5 deletions

View File

@ -1468,13 +1468,20 @@ open (const char *unix_path, int flags, ...)
|| !fh->open_with_arch (flags, mode & 07777))
__leave; /* errno already set */
#if 0
/* W10 1709 POSIX unlink semantics:
/* Don't use W10 1709 POSIX unlink semantics here.
TODO: Works nicely for O_TEMPFILE but using linkat requires that
we first fix /proc/self/fd handling to allow opening by handle
rather than by symlinked filename only. */
Including W10 1809, NtSetInformationFile(FileLinkInformation) on a
HANDLE to a file unlinked with POSIX semantics fails with
STATUS_ACCESS_DENIED. Trying to remove the delete disposition on
the file prior to calling link fails with STATUS_FILE_DELETED.
This breaks
fd = open(O_TMPFILE);
linkat("/proc/self/fd/<fd>);
semantics. */
if ((flags & O_TMPFILE) && wincap.has_posix_file_info ()
&& fh->pc.fs_is_ntfs ())
&& !fh->pc.isremote () && fh->pc.fs_is_ntfs ())
{
HANDLE del_h;
OBJECT_ATTRIBUTES attr;