diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2019-01-04 11:00:57 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-01-04 11:01:47 +0100 |
commit | 34d9bb709390b14b4ed0b1ea2656bf6bf5a055c3 (patch) | |
tree | 0b88ca577a37301c77a0ef98e8b8b48f87471e37 | |
parent | 353ebae30465606bd8b15bea1194f7a2881903fb (diff) | |
download | cygnal-34d9bb709390b14b4ed0b1ea2656bf6bf5a055c3.tar.gz cygnal-34d9bb709390b14b4ed0b1ea2656bf6bf5a055c3.tar.bz2 cygnal-34d9bb709390b14b4ed0b1ea2656bf6bf5a055c3.zip |
Cygwin: drop disabled O_TMPFILE POSIX unlink code
The commit message of commit 07e0a9584f9a5b2668c767ede0482a5fba498731
and the expectation set therein, are wrong.
There's no POSIX semantics allowing to link a file with a link
count of 0 and making it available in the file system again.
In fact, the Linux linkat extension AT_EMPTY_PATH explicitely
disallows to link a file descriptor to a file with a link count
of 0, except for O_TMPFILE without O_EXCL.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/syscalls.cc | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 0d4809037..73c15b133 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1467,46 +1467,6 @@ open (const char *unix_path, int flags, ...) if ((fh->is_fs_special () && fh->device_access_denied (flags)) || !fh->open_with_arch (flags, mode & 07777)) __leave; /* errno already set */ -#if 0 - /* Don't use W10 1709 POSIX unlink semantics here. - - 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.isremote () && fh->pc.fs_is_ntfs ()) - { - HANDLE del_h; - OBJECT_ATTRIBUTES attr; - NTSTATUS status; - IO_STATUS_BLOCK io; - FILE_DISPOSITION_INFORMATION_EX fdie; - - status = NtOpenFile (&del_h, DELETE, - fh->pc.init_reopen_attr (attr, fh->get_handle ()), &io, - FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT); - if (!NT_SUCCESS (status)) - debug_printf ("reopening tmpfile handle failed, status %y", status); - else - { - fdie.Flags = FILE_DISPOSITION_DELETE - | FILE_DISPOSITION_POSIX_SEMANTICS; - status = NtSetInformationFile (del_h, &io, &fdie, sizeof fdie, - FileDispositionInformationEx); - if (!NT_SUCCESS (status)) - debug_printf ("Setting POSIX delete disposition on tmpfile " - "failed, status = %y", status); - NtClose (del_h); - } - } -#endif fd = fh; if (fd <= 2) set_std_handle (fd); |