* 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.
This commit is contained in:
parent
bc8a5a9f66
commit
02a33ea774
|
@ -1,3 +1,11 @@
|
||||||
|
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>
|
2010-04-19 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* syscalls.cc (rename): On STATUS_ACCESS_VIOLATION, retry to open
|
* syscalls.cc (rename): On STATUS_ACCESS_VIOLATION, retry to open
|
||||||
|
|
|
@ -297,7 +297,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
||||||
int rcv = 0, len = sizeof (int);
|
int rcv = 0, len = sizeof (int);
|
||||||
|
|
||||||
if (handle_to_fn (handle, name))
|
if (handle_to_fn (handle, name))
|
||||||
/* ok */;
|
dev.parse (name);
|
||||||
else if (strcmp (name, ":sock:") == 0
|
else if (strcmp (name, ":sock:") == 0
|
||||||
/* On NT4, NtQueryObject returns STATUS_NOT_IMPLEMENTED when
|
/* On NT4, NtQueryObject returns STATUS_NOT_IMPLEMENTED when
|
||||||
called for a socket handle. */
|
called for a socket handle. */
|
||||||
|
@ -313,8 +313,6 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
||||||
dev = *piper_dev;
|
dev = *piper_dev;
|
||||||
else
|
else
|
||||||
dev = *pipew_dev;
|
dev = *pipew_dev;
|
||||||
if (name[0])
|
|
||||||
access = FILE_CREATE_PIPE_INSTANCE;
|
|
||||||
}
|
}
|
||||||
else if (GetConsoleScreenBufferInfo (handle, &buf))
|
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)
|
if (dev == FH_TTY || dev == FH_CONSOLE)
|
||||||
access |= GENERIC_READ | GENERIC_WRITE;
|
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)
|
else if (fd == 0)
|
||||||
access |= GENERIC_READ;
|
access |= GENERIC_READ;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue