* fhandler_serial.cc (fhandler_serial::raw_write): Prevent a deadlock when the

input buffer overflows.
(fhandler_serial::raw_read): Correct to print the actual error and only call
PurgeComm when necessary.
This commit is contained in:
Christopher Faylor 2004-01-23 15:22:48 +00:00
parent ed1a95dc25
commit a33df42223
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2004-01-22 Brian Ford <ford@vss.fsi.com>
* fhandler_serial.cc (fhandler_serial::raw_write): Prevent a deadlock
when the input buffer overflows.
(fhandler_serial::raw_read): Correct to print the actual error and only
call PurgeComm when necessary.
2004-01-22 Christopher Faylor <cgf@redhat.com> 2004-01-22 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (reent_data): Make global. * dcrt0.cc (reent_data): Make global.

View File

@ -133,16 +133,16 @@ fhandler_serial::raw_read (void *ptr, size_t& ulen)
continue; continue;
err: err:
PurgeComm (get_handle (), PURGE_RXABORT);
debug_printf ("err %E"); debug_printf ("err %E");
if (GetLastError () == ERROR_OPERATION_ABORTED) if (GetLastError () != ERROR_OPERATION_ABORTED)
n = 0;
else
{ {
PurgeComm (get_handle (), PURGE_RXABORT);
tot = -1; tot = -1;
__seterrno (); __seterrno ();
break; break;
} }
n = 0;
} }
out: out:
@ -169,6 +169,11 @@ fhandler_serial::raw_write (const void *ptr, size_t len)
switch (GetLastError ()) switch (GetLastError ())
{ {
case ERROR_OPERATION_ABORTED: case ERROR_OPERATION_ABORTED:
DWORD ev;
if (!ClearCommError (get_handle (), &ev, NULL))
goto err;
if (ev)
termios_printf ("error detected %x", ev);
continue; continue;
case ERROR_IO_PENDING: case ERROR_IO_PENDING:
break; break;