* fhandler_termios.cc (fhandler_termios::line_edit): Return line_edit_error and
remove last char from readahead buffer if accept_input() fails. * fhandler_tty.cc (fhandler_pty_master::accept_input): Return 0 and restore readahead buffer when tty slave pipe is full.
This commit is contained in:
parent
1a7ce58505
commit
b2be3149b4
|
@ -1,3 +1,12 @@
|
|||
2002-12-16 Steve Osborn <bub@io.com>
|
||||
Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* fhandler_termios.cc (fhandler_termios::line_edit): Return
|
||||
line_edit_error and remove last char from readahead buffer if
|
||||
accept_input() fails.
|
||||
* fhandler_tty.cc (fhandler_pty_master::accept_input): Return 0 and
|
||||
restore readahead buffer when tty slave pipe is full.
|
||||
|
||||
2002-12-16 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* pinfo.cc (_pinfo::cmdline): Allocate sufficient space for myself
|
||||
|
|
|
@ -326,7 +326,12 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
|
|||
put_readahead (c);
|
||||
if (!iscanon || always_accept || input_done)
|
||||
{
|
||||
(void) accept_input();
|
||||
if (!accept_input ())
|
||||
{
|
||||
ret = line_edit_error;
|
||||
eat_readahead (1);
|
||||
break;
|
||||
}
|
||||
ret = line_edit_input_done;
|
||||
input_done = 0;
|
||||
}
|
||||
|
|
|
@ -145,51 +145,48 @@ fhandler_pty_master::doecho (const void *str, DWORD len)
|
|||
int
|
||||
fhandler_pty_master::accept_input ()
|
||||
{
|
||||
DWORD bytes_left, written;
|
||||
DWORD n;
|
||||
DWORD rc;
|
||||
char* p;
|
||||
DWORD bytes_left;
|
||||
int ret = 1;
|
||||
|
||||
rc = WaitForSingleObject (input_mutex, INFINITE);
|
||||
(void) WaitForSingleObject (input_mutex, INFINITE);
|
||||
|
||||
bytes_left = n = eat_readahead (-1);
|
||||
p = rabuf;
|
||||
bytes_left = eat_readahead (-1);
|
||||
|
||||
if (n != 0)
|
||||
if (!bytes_left)
|
||||
{
|
||||
while (bytes_left > 0)
|
||||
{
|
||||
termios_printf ("about to write %d chars to slave", bytes_left);
|
||||
rc = WriteFile (get_output_handle (), p, bytes_left, &written, NULL);
|
||||
if (!rc)
|
||||
{
|
||||
debug_printf ("error writing to pipe %E");
|
||||
get_ttyp ()->read_retval = -1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
get_ttyp ()->read_retval = 1;
|
||||
termios_printf ("sending EOF to slave");
|
||||
get_ttyp ()->read_retval = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *p = rabuf;
|
||||
DWORD rc;
|
||||
DWORD written = 0;
|
||||
|
||||
termios_printf ("about to write %d chars to slave", bytes_left);
|
||||
rc = WriteFile (get_output_handle (), p, bytes_left, &written, NULL);
|
||||
if (!rc)
|
||||
{
|
||||
debug_printf ("error writing to pipe %E");
|
||||
get_ttyp ()->read_retval = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
get_ttyp ()->read_retval = 1;
|
||||
p += written;
|
||||
bytes_left -= written;
|
||||
if (bytes_left > 0)
|
||||
{
|
||||
debug_printf ("to_slave pipe is full");
|
||||
SetEvent (input_available_event);
|
||||
ReleaseMutex (input_mutex);
|
||||
Sleep (10);
|
||||
rc = WaitForSingleObject (input_mutex, INFINITE);
|
||||
puts_readahead (p, bytes_left);
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
termios_printf ("sending EOF to slave");
|
||||
get_ttyp ()->read_retval = 0;
|
||||
}
|
||||
|
||||
SetEvent (input_available_event);
|
||||
ReleaseMutex (input_mutex);
|
||||
return 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DWORD WINAPI
|
||||
|
|
Loading…
Reference in New Issue