Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed
The following Windows system calls currently fail with STATUS_IO_REPARSE_TAG_NOT_HANDLED when called on an AF_UNIX socket: - NtOpenFile in get_file_sd - NtOpenFile in set_file_sd - NtCreateFile in fhandler_base::open Fix this by adding the FILE_OPEN_REPARSE_POINT flag to those calls when the file is a known reparse point.
This commit is contained in:
parent
ea275093c1
commit
4b4fffe0f2
|
@ -620,13 +620,20 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
else
|
else
|
||||||
create_disposition = (flags & O_CREAT) ? FILE_OPEN_IF : FILE_OPEN;
|
create_disposition = (flags & O_CREAT) ? FILE_OPEN_IF : FILE_OPEN;
|
||||||
|
|
||||||
if (get_device () == FH_FS)
|
if (get_device () == FH_FS
|
||||||
|
#ifdef __WITH_AF_UNIX
|
||||||
|
|| get_device () == FH_UNIX
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
/* Add the reparse point flag to known repares points, otherwise we
|
/* Add the reparse point flag to known reparse points, otherwise we
|
||||||
open the target, not the reparse point. This would break lstat. */
|
open the target, not the reparse point. This would break lstat. */
|
||||||
if (pc.is_known_reparse_point ())
|
if (pc.is_known_reparse_point ())
|
||||||
options |= FILE_OPEN_REPARSE_POINT;
|
options |= FILE_OPEN_REPARSE_POINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (get_device () == FH_FS)
|
||||||
|
{
|
||||||
/* O_TMPFILE files are created with delete-on-close semantics, as well
|
/* O_TMPFILE files are created with delete-on-close semantics, as well
|
||||||
as with FILE_ATTRIBUTE_TEMPORARY. The latter speeds up file access,
|
as with FILE_ATTRIBUTE_TEMPORARY. The latter speeds up file access,
|
||||||
because the OS tries to keep the file in memory as much as possible.
|
because the OS tries to keep the file in memory as much as possible.
|
||||||
|
|
|
@ -65,7 +65,9 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
|
||||||
fh ? pc.init_reopen_attr (attr, fh)
|
fh ? pc.init_reopen_attr (attr, fh)
|
||||||
: pc.get_object_attr (attr, sec_none_nih),
|
: pc.get_object_attr (attr, sec_none_nih),
|
||||||
&io, FILE_SHARE_VALID_FLAGS,
|
&io, FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT);
|
FILE_OPEN_FOR_BACKUP_INTENT
|
||||||
|
| pc.is_known_reparse_point ()
|
||||||
|
? FILE_OPEN_REPARSE_POINT : 0);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
sd.free ();
|
sd.free ();
|
||||||
|
@ -232,7 +234,9 @@ set_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd, bool is_chown)
|
||||||
: pc.get_object_attr (attr, sec_none_nih),
|
: pc.get_object_attr (attr, sec_none_nih),
|
||||||
&io,
|
&io,
|
||||||
FILE_SHARE_VALID_FLAGS,
|
FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT);
|
FILE_OPEN_FOR_BACKUP_INTENT
|
||||||
|
| pc.is_known_reparse_point ()
|
||||||
|
? FILE_OPEN_REPARSE_POINT : 0);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
fh = NULL;
|
fh = NULL;
|
||||||
|
|
Loading…
Reference in New Issue