Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/dtable.cc18
2 files changed, 23 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 28bce1efd..68334b318 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,13 @@
2010-04-19 Corinna Vinschen <corinna@vinschen.de>
+ * dtable.cc (dtable::init_std_file_from_handle): Set dev to
+ valid content for ptys. Remove setting FILE_CREATE_PIPE_INSTANCE
+ in access flags since it's not needed. Set the access mask for
+ kernel objects according to what's returned by NtQueryInformationFile,
+ info class FileAccessInformation.
+
+2010-04-19 Corinna Vinschen <corinna@vinschen.de>
+
* syscalls.cc (rename): On STATUS_ACCESS_VIOLATION, retry to open
for DELETE until the STATUS_ACCESS_VIOLATION goes away. Add comment
to explain why.
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 2076ac998..67f9b4144 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -297,7 +297,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
int rcv = 0, len = sizeof (int);
if (handle_to_fn (handle, name))
- /* ok */;
+ dev.parse (name);
else if (strcmp (name, ":sock:") == 0
/* On NT4, NtQueryObject returns STATUS_NOT_IMPLEMENTED when
called for a socket handle. */
@@ -313,8 +313,6 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
dev = *piper_dev;
else
dev = *pipew_dev;
- if (name[0])
- access = FILE_CREATE_PIPE_INSTANCE;
}
else if (GetConsoleScreenBufferInfo (handle, &buf))
{
@@ -361,8 +359,22 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
}
}
+ IO_STATUS_BLOCK io;
+ FILE_ACCESS_INFORMATION fai;
+
+ /* Console windows are not kernel objects, so the access mask returned
+ by NtQueryInformationFile is meaningless. */
if (dev == FH_TTY || dev == FH_CONSOLE)
access |= GENERIC_READ | GENERIC_WRITE;
+ else if (NT_SUCCESS (NtQueryInformationFile (handle, &io, &fai,
+ sizeof fai,
+ FileAccessInformation)))
+ {
+ if (fai.AccessFlags & FILE_READ_DATA)
+ access |= GENERIC_READ;
+ if (fai.AccessFlags & FILE_WRITE_DATA)
+ access |= GENERIC_WRITE;
+ }
else if (fd == 0)
access |= GENERIC_READ;
else