Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save elieux/be506676a5ec56f0b124 to your computer and use it in GitHub Desktop.
Save elieux/be506676a5ec56f0b124 to your computer and use it in GitHub Desktop.
MSYS2 runtime patch for msys2/MSYS2-packages#242
From f7a540110b276fd4380ceaa72f42c0119d8d8610 Mon Sep 17 00:00:00 2001
From: David Macek <[email protected]>
Date: Tue, 12 May 2015 00:08:11 +0200
Subject: [PATCH] Remove FILE_OPEN_FOR_BACKUP_INTENT
---
winsup/cygwin/exceptions.cc | 6 +++---
winsup/cygwin/fhandler.cc | 2 +-
winsup/cygwin/fhandler_disk_file.cc | 32 ++++++++++++++++----------------
winsup/cygwin/fhandler_procsys.cc | 4 ++--
winsup/cygwin/fhandler_socket.cc | 16 ++++++++--------
winsup/cygwin/hookapi.cc | 2 +-
winsup/cygwin/miscfuncs.cc | 6 +++---
winsup/cygwin/mmap.cc | 2 +-
winsup/cygwin/mount.cc | 6 +++---
winsup/cygwin/ntea.cc | 14 +++++++-------
winsup/cygwin/path.cc | 32 ++++++++++++++++----------------
winsup/cygwin/security.cc | 6 +++---
winsup/cygwin/spawn.cc | 2 +-
winsup/cygwin/syscalls.cc | 18 +++++++++---------
14 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 32fd7f1..de8d85e 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -190,7 +190,7 @@ cygwin_exception::open_stackdumpfile ()
status = NtCreateFile (&h, GENERIC_WRITE | SYNCHRONIZE, &attr, &io,
NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT, NULL, 0);
+ | 0, NULL, 0);
if (NT_SUCCESS (status))
{
if (!myself->cygstarted)
@@ -821,7 +821,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
/* POSIX requires that for SIGSEGV and SIGBUS, si_addr should be set to the
address of faulting memory reference. For SIGILL and SIGFPE these should
be the address of the faulting instruction. Other signals are apparently
- undefined so we just set those to the faulting instruction too. */
+ undefined so we just set those to the faulting instruction too. */
si.si_addr = (si.si_signo == SIGSEGV || si.si_signo == SIGBUS)
? (void *) e->ExceptionInformation[1] : (void *) in->_GR(ip);
me.incyg++;
@@ -1418,7 +1418,7 @@ sigpacket::process ()
}
}
}
-
+
/* !tls means no threads available to catch a signal. */
if (!tls)
{
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 4c1bdba..ce50aee 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -560,7 +560,7 @@ fhandler_base::open (int flags, mode_t mode)
pc.get_object_attr (attr, *sec_none_cloexec (flags));
- options = FILE_OPEN_FOR_BACKUP_INTENT;
+ options = 0;
switch (query_open ())
{
case query_read_control:
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index b283934..a27c808 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -191,7 +191,7 @@ readdir_check_reparse_point (POBJECT_ATTRIBUTES attr)
if (NT_SUCCESS (NtOpenFile (&reph, READ_CONTROL, attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| FILE_OPEN_REPARSE_POINT)))
{
PREPARSE_DATA_BUFFER rp = (PREPARSE_DATA_BUFFER)
@@ -250,7 +250,7 @@ path_conv::ndisk_links (DWORD nNumberOfLinks)
get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_DIRECTORY_FILE)))
return nNumberOfLinks;
@@ -467,7 +467,7 @@ fhandler_base::fstat_by_name (struct stat *buf)
status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
&attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
debug_printf ("%y = NtOpenFile(%S)", status,
@@ -675,7 +675,7 @@ fhandler_base::fstat_helper (struct stat *buf, DWORD nNumberOfLinks)
status = NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA,
pc.init_reopen_attr (attr, h), &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS (status))
debug_printf ("%y = NtOpenFile(%S)", status,
@@ -751,7 +751,7 @@ fhandler_disk_file::fstatvfs (struct statvfs *sfs)
opened = NT_SUCCESS (NtOpenFile (&fh, READ_CONTROL,
pc.get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT));
+ 0));
if (!opened)
{
/* Can't open file. Try again with parent dir. */
@@ -760,7 +760,7 @@ fhandler_disk_file::fstatvfs (struct statvfs *sfs)
attr.ObjectName = &dirname;
opened = NT_SUCCESS (NtOpenFile (&fh, READ_CONTROL, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT));
+ 0));
if (!opened)
goto out;
}
@@ -817,12 +817,12 @@ fhandler_disk_file::fstatvfs (struct statvfs *sfs)
}
else
debug_printf ("%y = NtQueryVolumeInformationFile"
- "(%S, FileFsSizeInformation)",
+ "(%S, FileFsSizeInformation)",
status, pc.get_nt_native_path ());
}
else
debug_printf ("%y = NtQueryVolumeInformationFile"
- "(%S, FileFsFullSizeInformation)",
+ "(%S, FileFsFullSizeInformation)",
status, pc.get_nt_native_path ());
out:
if (opened)
@@ -945,7 +945,7 @@ fhandler_disk_file::fchmod (mode_t mode)
if (NT_SUCCESS (NtOpenFile (&fh, FILE_WRITE_ATTRIBUTES,
pc.init_reopen_attr (attr, get_handle ()),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT)))
+ 0)))
{
NtSetAttributesFile (fh, pc.file_attributes ());
NtClose (fh);
@@ -1459,7 +1459,7 @@ fhandler_base::utimens_fs (const struct timespec *tvp)
if (NT_SUCCESS (NtOpenFile (&fh, FILE_WRITE_ATTRIBUTES,
pc.init_reopen_attr (attr, get_handle ()),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT)))
+ 0)))
{
NtSetInformationFile (fh, &io, &fbi, sizeof fbi,
FileBasicInformation);
@@ -1814,7 +1814,7 @@ fhandler_disk_file::mkdir (mode_t mode)
FILE_ATTRIBUTE_DIRECTORY, FILE_SHARE_VALID_FLAGS,
FILE_CREATE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT,
+ | 0,
p, plen);
if (NT_SUCCESS (status))
{
@@ -1973,7 +1973,7 @@ fhandler_disk_file::opendir (int fd)
pc.get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
{
@@ -2076,7 +2076,7 @@ readdir_get_ino (const char *path, bool dot_dot)
|| NT_SUCCESS (NtOpenFile (&hdl, READ_CONTROL,
pc.get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| (pc.is_rep_symlink ()
? FILE_OPEN_REPARSE_POINT : 0)))
)
@@ -2141,7 +2141,7 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err,
directory of the mounted drive. */
if (NT_SUCCESS (NtOpenFile (&reph, READ_CONTROL, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT)))
+ 0)))
{
de->d_ino = pc.get_ino_by_handle (reph);
NtClose (reph);
@@ -2375,11 +2375,11 @@ go_ahead:
f_status = (dir->__flags & dirent_nfs_d_ino)
? NtCreateFile (&hdl, READ_CONTROL, &attr, &io,
NULL, 0, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN, FILE_OPEN_FOR_BACKUP_INTENT,
+ FILE_OPEN, 0,
&nfs_aol_ffei, sizeof nfs_aol_ffei)
: NtOpenFile (&hdl, READ_CONTROL, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| FILE_OPEN_REPARSE_POINT);
if (NT_SUCCESS (f_status))
{
diff --git a/winsup/cygwin/fhandler_procsys.cc b/winsup/cygwin/fhandler_procsys.cc
index 1e937c8..9a181a3 100644
--- a/winsup/cygwin/fhandler_procsys.cc
+++ b/winsup/cygwin/fhandler_procsys.cc
@@ -111,7 +111,7 @@ fhandler_procsys::exists (struct stat *buf)
return virt_directory;
/* Next try to open as file/device. */
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES, &attr, &io,
- FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
+ FILE_SHARE_VALID_FLAGS, 0);
debug_printf ("NtOpenFile: %y", status);
/* Name is invalid, that's nothing. */
if (status == STATUS_OBJECT_NAME_INVALID)
@@ -153,7 +153,7 @@ fhandler_procsys::exists (struct stat *buf)
RtlSplitUnicodePath (&dir, &dir, NULL);
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES,
&attr, &io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
debug_printf ("NtOpenDirectoryObject: %y", status);
if (dir.Length > sizeof (WCHAR))
dir.Length -= sizeof (WCHAR);
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index e441fd1..6a70366 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -149,7 +149,7 @@ get_inet_addr (const struct sockaddr *in, int inlen,
status = NtOpenFile (&fh, GENERIC_READ | SYNCHRONIZE, &attr, &io,
FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_NON_DIRECTORY_FILE);
if (status == STATUS_SHARING_VIOLATION)
{
@@ -645,7 +645,7 @@ fhandler_socket::evaluate_events (const long event_mask, long &events,
{
wsock_events->connect_errorcode = evts.iErrorCode[FD_CONNECT_BIT];
- /* Setting the connect_state and calling the AF_LOCAL handshake
+ /* Setting the connect_state and calling the AF_LOCAL handshake
here allows to handle this stuff from a single point. This
is independent of FD_CONNECT being requested. Consider a
server calling connect(2) and then immediately poll(2) with
@@ -655,7 +655,7 @@ fhandler_socket::evaluate_events (const long event_mask, long &events,
Something weird occurs in Winsock: If you fork off and call
recv/send on the duplicated, already connected socket, another
FD_CONNECT event is generated in the child process. This
- would trigger a call to af_local_connect which obviously fail.
+ would trigger a call to af_local_connect which obviously fail.
Avoid this by calling set_connect_state only if connect_state
is connect_pending. */
if (connect_state () == connect_pending)
@@ -695,7 +695,7 @@ fhandler_socket::evaluate_events (const long event_mask, long &events,
socket. We're trying to workaround this problem here by
taking the connect errorcode from the event and write it back
into the SO_ERROR socket option.
-
+
CV 2014-06-16: Call WSASetLastError *after* setsockopt since,
apparently, setsockopt sets the last WSA error code to 0 on
success. */
@@ -1066,7 +1066,7 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen)
NULL, fattr, 0, FILE_CREATE,
FILE_NON_DIRECTORY_FILE
| FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT,
+ | 0,
NULL, 0);
if (!NT_SUCCESS (status))
{
@@ -1156,7 +1156,7 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
if (get_socket_type () == SOCK_STREAM)
af_local_set_cred ();
}
-
+
/* Initialize connect state to "connect_pending". State is ultimately set
to "connected" or "connect_failed" in wait_for_events when the FD_CONNECT
event occurs. Note that the underlying OS sockets are always non-blocking
@@ -1181,7 +1181,7 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
if (res)
{
DWORD err = WSAGetLastError ();
-
+
/* Some applications use the ugly technique to check if a non-blocking
connect succeeded by calling connect again, until it returns EISCONN.
This circumvents the event handling and connect_state is never set.
@@ -1642,7 +1642,7 @@ fhandler_socket::read (void *in_ptr, size_t& len)
WSABUF wsabuf = { len, ptr };
WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 };
#endif
-
+
len = recv_internal (&wsamsg, false);
}
diff --git a/winsup/cygwin/hookapi.cc b/winsup/cygwin/hookapi.cc
index d1f4ee9..71a14e9 100644
--- a/winsup/cygwin/hookapi.cc
+++ b/winsup/cygwin/hookapi.cc
@@ -255,7 +255,7 @@ find_first_notloaded_dll (path_conv& pc)
pc.get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_NON_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
goto out;
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 7f324b9..fe2a644 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -236,7 +236,7 @@ check_iovec (const struct iovec *iov, int iovcnt, bool forwrite)
return -1;
}
-/* Try hard to schedule another thread.
+/* Try hard to schedule another thread.
Remember not to call this in a lock condition or you'll potentially
suffer starvation. */
void
@@ -396,7 +396,7 @@ NT_readline::init (POBJECT_ATTRIBUTES attr, PCHAR in_buf, ULONG in_buflen)
status = NtOpenFile (&fh, SYNCHRONIZE | FILE_READ_DATA, attr, &io,
FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT);
+ | 0);
if (!NT_SUCCESS (status))
{
paranoid_printf ("NtOpenFile(%S) failed, status %y",
@@ -411,7 +411,7 @@ NT_readline::init (POBJECT_ATTRIBUTES attr, PCHAR in_buf, ULONG in_buflen)
return true;
}
-PCHAR
+PCHAR
NT_readline::gets ()
{
IO_STATUS_BLOCK io;
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 8175d6e..930ec93 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -1017,7 +1017,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, off_t off)
fh->get_access () | GENERIC_EXECUTE | SYNCHRONIZE,
&attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT);
+ | 0);
if (NT_SUCCESS (status))
{
fh_disk_file = new (ccalloc (HEAP_FHANDLER, 1, sizeof *fh_disk_file))
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 1d49e18..26a0aae 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -192,14 +192,14 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
is that symlink_info::check relies on being able to open a handle
to the target of a volume mount point. */
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
/* At least one filesystem (HGFS, VMware shared folders) doesn't like
to be opened with access set to just READ_CONTROL. */
if (status == STATUS_INVALID_PARAMETER)
{
access |= FILE_READ_DATA;
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
}
while (!NT_SUCCESS (status)
&& (attr.ObjectName->Length > 7 * sizeof (WCHAR)
@@ -215,7 +215,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
else if (dir.Length > 7 * sizeof (WCHAR))
dir.Length -= sizeof (WCHAR);
status = NtOpenFile (&vol, access, &attr, &io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
}
if (!NT_SUCCESS (status))
{
diff --git a/winsup/cygwin/ntea.cc b/winsup/cygwin/ntea.cc
index 9e18fa7..669977c 100644
--- a/winsup/cygwin/ntea.cc
+++ b/winsup/cygwin/ntea.cc
@@ -24,15 +24,15 @@ details. */
#define MAX_EA_NAME_LEN 256
#define MAX_EA_VALUE_LEN 65536
-/* At least one maximum sized entry fits.
+/* At least one maximum sized entry fits.
CV 2014-04-04: NtQueryEaFile function chokes on buffers bigger than 64K
with STATUS_INVALID_PARAMETER if the handle points to a file
on a remote share, at least on Windows 7 and later.
In theory the buffer should have a size of
-
+
sizeof (FILE_FULL_EA_INFORMATION) + MAX_EA_NAME_LEN
+ MAX_EA_VALUE_LEN
-
+
(65804 bytes), but we're opting for simplicity here, and
a 64K buffer has the advantage that we can use a tmp_pathbuf
buffer, rather than having to alloca 64K from stack. */
@@ -74,7 +74,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
{
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_EA, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
if (!NT_SUCCESS (status))
{
__seterrno_from_nt_status (status);
@@ -123,7 +123,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
}
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_EA, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
if (!NT_SUCCESS (status))
break;
hdl = NULL;
@@ -259,7 +259,7 @@ write_ea (HANDLE hdl, path_conv &pc, const char *name, const char *value,
{
status = NtOpenFile (&h, READ_CONTROL | FILE_WRITE_EA, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
if (!NT_SUCCESS (status))
{
__seterrno_from_nt_status (status);
@@ -326,7 +326,7 @@ write_ea (HANDLE hdl, path_conv &pc, const char *name, const char *value,
}
status = NtOpenFile (&h, READ_CONTROL | FILE_WRITE_EA, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
if (!NT_SUCCESS (status))
break;
hdl = NULL;
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 7df8f9f..aeef113 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -592,7 +592,7 @@ getfileattr (const char *path, bool caseinsensitive) /* path has to be always ab
status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
&attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_DIRECTORY_FILE);
if (NT_SUCCESS (status))
{
@@ -1683,7 +1683,7 @@ symlink_nfs (const char *oldpath, path_conv &win32_newpath)
&io, NULL, FILE_ATTRIBUTE_SYSTEM,
FILE_SHARE_VALID_FLAGS, FILE_CREATE,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT,
+ | 0,
pffei, NT_MAX_PATH * sizeof (WCHAR));
if (!NT_SUCCESS (status))
{
@@ -2164,7 +2164,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool isdevice)
status = NtOpenFile (&fh, FILE_WRITE_ATTRIBUTES,
win32_newpath.get_object_attr (attr,
sec_none_nih),
- &io, 0, FILE_OPEN_FOR_BACKUP_INTENT);
+ &io, 0, 0);
if (!NT_SUCCESS (status))
{
__seterrno_from_nt_status (status);
@@ -2197,7 +2197,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool isdevice)
isdevice ? FILE_OVERWRITE_IF : FILE_CREATE,
FILE_SYNCHRONOUS_IO_NONALERT
| FILE_NON_DIRECTORY_FILE
- | FILE_OPEN_FOR_BACKUP_INTENT,
+ | 0,
NULL, 0);
if (!NT_SUCCESS (status))
{
@@ -2633,7 +2633,7 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes)
/* Avoid attaching suffixes if the resulting filename would be invalid.
For performance reasons we don't check the length of a suffix, since
we know that all suffixes are 4 chars in length.
-
+
FIXME: This is not really correct. A fully functional test should
work on wide character paths. This would probably also speed
up symlink_info::check. */
@@ -2845,7 +2845,7 @@ restart:
&attr, &io, NULL, 0, FILE_SHARE_VALID_FLAGS,
FILE_OPEN,
FILE_OPEN_REPARSE_POINT
- | FILE_OPEN_FOR_BACKUP_INTENT,
+ | 0,
eabuf, easize);
debug_printf ("%y = NtCreateFile (%S)", status, &upath);
/* No right to access EAs or EAs not supported? */
@@ -2869,7 +2869,7 @@ restart:
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES,
&attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_OPEN_REPARSE_POINT
- | FILE_OPEN_FOR_BACKUP_INTENT);
+ | 0);
debug_printf ("%y = NtOpenFile (no-EAs %S)", status, &upath);
}
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
@@ -2885,7 +2885,7 @@ restart:
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES,
&attr, &io, FILE_SHARE_VALID_FLAGS,
FILE_OPEN_REPARSE_POINT
- | FILE_OPEN_FOR_BACKUP_INTENT);
+ | 0);
debug_printf ("%y = NtOpenFile (broken-UDF, %S)", status, &upath);
attr.Attributes = 0;
if (NT_SUCCESS (status))
@@ -3020,7 +3020,7 @@ restart:
status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
&dattr, &io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
{
@@ -3144,7 +3144,7 @@ restart:
status = NtOpenFile (&sym_h, SYNCHRONIZE | GENERIC_READ, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS (status))
res = 0;
@@ -3188,7 +3188,7 @@ restart:
status = NtOpenFile (&sym_h, SYNCHRONIZE | GENERIC_READ, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS (status))
@@ -3465,7 +3465,7 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions,
// Must return something ..
size_t arglen = (arg ? strlen (arg): 0);
-
+
if (arglen == 0 || !arg)
{
arg_result = (char *)malloc (sizeof (char));
@@ -4663,7 +4663,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
- SetCurrentDirectory fails for directories with strict permissions even
for processes with the SE_BACKUP_NAME privilege enabled. The reason
is apparently that SetCurrentDirectory calls NtOpenFile without the
- FILE_OPEN_FOR_BACKUP_INTENT flag set.
+ 0 flag set.
- SetCurrentDirectory does not support case-sensitivity.
@@ -4706,7 +4706,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
not quite clear if that's really required, but since we don't know
the side effects of this action, we better follow Windows' lead. */
ULONG old_dismount_count = SharedUserData.DismountCount;
- /* Open a directory handle with FILE_OPEN_FOR_BACKUP_INTENT and with all
+ /* Open a directory handle with 0 and with all
sharing flags set. The handle is right now used in exceptions.cc only,
but that might change in future. */
HANDLE h = NULL;
@@ -4729,7 +4729,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
InitializeObjectAttributes (&attr, &upath,
nat_cwd->objcaseinsensitive () | OBJ_INHERIT,
NULL, NULL);
- /* First try without FILE_OPEN_FOR_BACKUP_INTENT, to find out if the
+ /* First try without 0, to find out if the
directory is valid for Win32 apps. And, no, we can't just call
SetCurrentDirectory here, since that would potentially break
case-sensitivity. */
@@ -4743,7 +4743,7 @@ cwdstuff::set (path_conv *nat_cwd, const char *posix_cwd)
FILE_SHARE_VALID_FLAGS,
FILE_DIRECTORY_FILE
| FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT);
+ | 0);
inaccessible_path = true;
}
if (!NT_SUCCESS (status))
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index bee9b06..11cd451 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -68,7 +68,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
fh ? pc.init_reopen_attr (attr, fh)
: pc.get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
if (!NT_SUCCESS (status))
{
sd.free ();
@@ -130,7 +130,7 @@ get_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd,
NULL, NULL);
status = NtOpenFile (&fh, READ_CONTROL, &attr, &io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| FILE_OPEN_REPARSE_POINT);
if (!NT_SUCCESS (status))
{
@@ -235,7 +235,7 @@ set_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd, bool is_chown)
: pc.get_object_attr (attr, sec_none_nih),
&io,
FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT);
+ 0);
if (!NT_SUCCESS (status))
{
fh = NULL;
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index df5777f..2255f84 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -1108,7 +1108,7 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext,
real_path.get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
- | FILE_OPEN_FOR_BACKUP_INTENT
+ | 0
| FILE_NON_DIRECTORY_FILE);
if (!NT_SUCCESS (status))
{
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 8c0c533..43c00f2 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -352,7 +352,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags)
InitializeObjectAttributes (&attr, &root, OBJ_CASE_INSENSITIVE,
NULL, NULL);
status = NtOpenFile (&rootdir, FILE_TRAVERSE, &attr, &io,
- FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
+ FILE_SHARE_VALID_FLAGS, 0);
if (!NT_SUCCESS (status))
{
debug_printf ("NtOpenFile (%S) failed, status = %y", &root, status);
@@ -425,7 +425,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags)
InitializeObjectAttributes (&attr, &root, OBJ_CASE_INSENSITIVE,
NULL, NULL);
status = NtOpenFile (&rootdir, FILE_ADD_SUBDIRECTORY, &attr, &io,
- FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
+ FILE_SHARE_VALID_FLAGS, 0);
if (!NT_SUCCESS (status))
{
debug_printf ("NtOpenFile (%S) failed, status = %y",
@@ -706,7 +706,7 @@ unlink_nt (path_conv &pc)
syscall_printf ("Trying to delete %S, isdir = %d",
pc.get_nt_native_path (), pc.isdir ());
ACCESS_MASK access = DELETE;
- ULONG flags = FILE_OPEN_FOR_BACKUP_INTENT;
+ ULONG flags = 0;
/* Add the reparse point flag to native symlinks, otherwise we remove the
target, not the symlink. */
if (pc.is_rep_symlink ())
@@ -1401,7 +1401,7 @@ open (const char *unix_path, int flags, ...)
if (fd >= 0)
{
/* This is a temporary kludge until all utilities can catch up
- with a change in behavior that implements linux functionality:
+ with a change in behavior that implements linux functionality:
opening a tty should not automatically cause it to become the
controlling tty for the process. */
int opt = PC_OPEN | ((flags & (O_NOFOLLOW | O_EXCL))
@@ -1754,7 +1754,7 @@ fhandler_base::stat_fixup (struct stat *buf)
buf->st_ino = FH_TTY;
else
buf->st_ino = get_device ();
-
+
}
/* For /dev-based devices, st_dev must be set to the device number of /dev,
not it's own device major/minor numbers. What we do here to speed up
@@ -2439,7 +2439,7 @@ rename (const char *oldpath, const char *newpath)
| (oldpc.fs_is_cifs () ? FILE_READ_ATTRIBUTES : 0);
ULONG sharing = FILE_SHARE_READ | FILE_SHARE_WRITE
| (oldpc.fs_is_samba () ? 0 : FILE_SHARE_DELETE);
- ULONG flags = FILE_OPEN_FOR_BACKUP_INTENT
+ ULONG flags = 0
| (oldpc.is_rep_symlink () ? FILE_OPEN_REPARSE_POINT : 0);
status = NtOpenFile (&fh, access,
oldpc.get_object_attr (attr, sec_none_nih),
@@ -2503,7 +2503,7 @@ rename (const char *oldpath, const char *newpath)
status = NtOpenFile (&nfh, FILE_WRITE_ATTRIBUTES,
dstpc->get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| (dstpc->is_rep_symlink ()
? FILE_OPEN_REPARSE_POINT : 0));
if (!NT_SUCCESS (status))
@@ -2537,7 +2537,7 @@ rename (const char *oldpath, const char *newpath)
&& NT_SUCCESS (NtOpenFile (&nfh, READ_CONTROL,
(removepc ?: dstpc)->get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| ((removepc ?: dstpc)->is_rep_symlink ()
? FILE_OPEN_REPARSE_POINT : 0))))
{
@@ -2604,7 +2604,7 @@ rename (const char *oldpath, const char *newpath)
status = NtOpenFile (&fh, DELETE,
oldpc.get_object_attr (attr, sec_none_nih),
&io, FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
+ 0
| (oldpc.is_rep_symlink ()
? FILE_OPEN_REPARSE_POINT : 0));
if (!NT_SUCCESS (status))
--
1.9.5.msysgit.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment