diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-04-19 16:25:11 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-04-19 16:25:11 +0000 |
commit | 02a33ea774fed6feeeabe2779eef6739e094100e (patch) | |
tree | bbb7e2793244b875505845e547ed67220b3a437c /winsup | |
parent | bc8a5a9f661a1a659be6b58d7ef27ece3994aa19 (diff) | |
download | cygnal-02a33ea774fed6feeeabe2779eef6739e094100e.tar.gz cygnal-02a33ea774fed6feeeabe2779eef6739e094100e.tar.bz2 cygnal-02a33ea774fed6feeeabe2779eef6739e094100e.zip |
* 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.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 18 |
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 |