From 2bfdcd8a5f94fd126997796f61b56a09a96820e6 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 20 Dec 2000 05:57:59 +0000 Subject: [PATCH] * fhandler_serial.cc (fhandler_serial::raw_read): Always find number of bytes ready to be read whether overlapped_armed or not. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/exceptions.cc | 4 ++-- winsup/cygwin/fhandler_serial.cc | 17 +++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8e0a9037c..f56b272a5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Wed Dec 20 00:57:10 2000 Christopher Faylor + + * fhandler_serial.cc (fhandler_serial::raw_read): Always find number of + bytes ready to be read whether overlapped_armed or not. + Tue Dec 19 21:39:00 2000 Corinna Vinschen * syscalls.cc (remove): New function, overriding the newlib diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index d30eb32db..6e27f1098 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1072,8 +1072,8 @@ events_terminate (void) #define pid_offset (unsigned)(((_pinfo *)NULL)->pid) extern "C" { -static void __stdcall reset_signal_arrived () __attribute__ ((unused)); -static void __stdcall +static void volatile __stdcall reset_signal_arrived () __attribute__ ((unused)); +static void volatile __stdcall reset_signal_arrived () { (void) ResetEvent (signal_arrived); diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index c1e472bdf..838da6b9d 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -79,15 +79,16 @@ fhandler_serial::raw_read (void *ptr, size_t ulen) // if vmin > ulen then things won't work right. overlapped_armed = -1; } - if (!overlapped_armed) + + if (!ClearCommError (get_handle (), &ev, &st)) + goto err; + else if (ev) + termios_printf ("error detected %x", ev); + else if (st.cbInQue) + inq = st.cbInQue; + else if (!overlapped_armed) { - if (!ClearCommError (get_handle (), &ev, &st)) - goto err; - else if (ev) - termios_printf ("error detected %x", ev); - else if (st.cbInQue) - inq = st.cbInQue; - else if ((size_t)tot >= minchars) + if ((size_t)tot >= minchars) break; else if (WaitCommEvent (get_handle (), &ev, &io_status)) {