diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2018-12-26 23:51:13 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2018-12-27 00:16:59 +0300 |
commit | 07e0a9584f9a5b2668c767ede0482a5fba498731 (patch) | |
tree | 9b842b9e8b11595d178ce5ae4c1b114b3b220cdf | |
parent | 7148fbc49688986b3648ba6ce3f2afd527d8baa0 (diff) |
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>
-rw-r--r-- | winsup/cygwin/syscalls.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index c1a3ed418..0d4809037 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -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; |