* 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.
This commit is contained in:
Christopher Faylor
2012-05-04 03:00:43 +00:00
parent 1c46670094
commit fb9d631817
3 changed files with 53 additions and 2 deletions

View File

@@ -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: