summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dtable.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r--winsup/cygwin/dtable.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 67f9b4144..7f52c9750 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -363,8 +363,9 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
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)
+ by NtQueryInformationFile is meaningless. CMD always hands down
+ stdin handles as R/O handles, but our tty slave sides are R/W. */
+ if (dev == FH_TTY || dev == FH_CONSOLE || dev.major == DEV_TTYS_MAJOR)
access |= GENERIC_READ | GENERIC_WRITE;
else if (NT_SUCCESS (NtQueryInformationFile (handle, &io, &fai,
sizeof fai,