]> sourceware.org Git - newlib-cygwin.git/commitdiff
* fhandler_serial.cc (fhandler_serial::raw_write): Prevent a deadlock when the
authorChristopher Faylor <me@cgf.cx>
Fri, 23 Jan 2004 15:22:48 +0000 (15:22 +0000)
committerChristopher Faylor <me@cgf.cx>
Fri, 23 Jan 2004 15:22:48 +0000 (15:22 +0000)
input buffer overflows.
(fhandler_serial::raw_read): Correct to print the actual error and only call
PurgeComm when necessary.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_serial.cc

index e5c57bd51d1433088a5a2e2e5a6208354d7ee6c2..60cec328e60adbb40f877d0ef13b576fab95f5ac 100644 (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>
 
        * dcrt0.cc (reent_data): Make global.
index efb1af99bb7f04f8e1ea40111ab394f592af11bf..c5e1f6d985231d25d54beedfcd10a74240f8eb48 100644 (file)
@@ -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;
This page took 0.030673 seconds and 5 git commands to generate.