diff options
author | Christopher Faylor <me@cgf.cx> | 2004-01-23 15:22:48 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-01-23 15:22:48 +0000 |
commit | a33df42223e3261d26975db9a92945a187471fac (patch) | |
tree | f9baebf4c6ce6844bd3fe9f621b81f1c69a9b247 /winsup/cygwin | |
parent | ed1a95dc2529af31b0c622da451334a12ef6d436 (diff) | |
download | cygnal-a33df42223e3261d26975db9a92945a187471fac.tar.gz cygnal-a33df42223e3261d26975db9a92945a187471fac.tar.bz2 cygnal-a33df42223e3261d26975db9a92945a187471fac.zip |
* 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.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_serial.cc | 13 |
2 files changed, 16 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e5c57bd51..60cec328e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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> * dcrt0.cc (reent_data): Make global. diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index efb1af99b..c5e1f6d98 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -133,16 +133,16 @@ fhandler_serial::raw_read (void *ptr, size_t& ulen) continue; err: - PurgeComm (get_handle (), PURGE_RXABORT); debug_printf ("err %E"); - if (GetLastError () == ERROR_OPERATION_ABORTED) - n = 0; - else + if (GetLastError () != ERROR_OPERATION_ABORTED) { + PurgeComm (get_handle (), PURGE_RXABORT); tot = -1; __seterrno (); break; } + + n = 0; } out: @@ -169,6 +169,11 @@ fhandler_serial::raw_write (const void *ptr, size_t len) switch (GetLastError ()) { case ERROR_OPERATION_ABORTED: + DWORD ev; + if (!ClearCommError (get_handle (), &ev, NULL)) + goto err; + if (ev) + termios_printf ("error detected %x", ev); continue; case ERROR_IO_PENDING: break; |