diff options
author | Christopher Faylor <me@cgf.cx> | 2012-05-04 03:00:43 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2012-05-04 03:00:43 +0000 |
commit | fb9d631817cc2b5d83c2a6ff928851d201c992bf (patch) | |
tree | 301366120027029add7b63a428cb3e8f7fcf3f0d /winsup/cygwin/fhandler_tty.cc | |
parent | 1c46670094d3fb8c10bc4663f3efb587c47cb39d (diff) | |
download | cygnal-fb9d631817cc2b5d83c2a6ff928851d201c992bf.tar.gz cygnal-fb9d631817cc2b5d83c2a6ff928851d201c992bf.tar.bz2 cygnal-fb9d631817cc2b5d83c2a6ff928851d201c992bf.zip |
* DevNotes: Add entry cgf-000002.
* fhandler_tty.cc (bytes_available): Revert to previous Oct-2011 behavior where
a dummy buffer is used to determine how many bytes will be read.
(fhandler_pty_master::ioctl): Correct coercion in assignment.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 1145bd14f..1428a064e 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -53,7 +53,11 @@ fhandler_pty_slave::get_unit () bool bytes_available (DWORD& n, HANDLE h) { - bool succeeded = PeekNamedPipe (h, NULL, 0, NULL, &n, NULL); + char buf[INP_BUFFER_SIZE]; + /* Apparently need to pass in a dummy buffer to read a real "record" from + the pipe. So buf is used and then discarded just so we can see how many + bytes will be read by the next ReadFile(). */ + bool succeeded = PeekNamedPipe (h, buf, sizeof (buf), &n, NULL, NULL); if (!succeeded) { termios_printf ("PeekNamedPipe(%p) failed, %E", h); @@ -1429,7 +1433,7 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg) set_errno (EINVAL); return -1; } - *(int *) arg = (DWORD) n; + *(int *) arg = (int) n; } break; default: |