From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 0F7693861C56; Mon, 16 Mar 2020 09:20:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F7693861C56 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: serial: wait for CancelIo completion X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: b37a3388cca2df92c204ab8693b09966dca2dad4 X-Git-Newrev: 7947581905637b837558ae9a2f1d35b8ab433e90 Message-Id: <20200316092030.0F7693861C56@sourceware.org> Date: Mon, 16 Mar 2020 09:20:30 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2020 09:20:30 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7947581905637b837558ae9a2f1d35b8ab433e90 commit 7947581905637b837558ae9a2f1d35b8ab433e90 Author: Corinna Vinschen Date: Mon Mar 16 10:20:16 2020 +0100 Cygwin: serial: wait for CancelIo completion Per https://devblogs.microsoft.com/oldnewthing/20110202-00/?p=11613 GetOverlappedResult must be called blocking, waiting for the overlapped operation to complete. Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/fhandler_serial.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index f92fc7039..f729765e0 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -135,7 +135,7 @@ fhandler_serial::raw_read (void *ptr, size_t& ulen) PurgeComm apparently discards in-flight bytes while CancelIo only stops the overlapped IO routine. */ CancelIo (get_handle ()); - if (GetOverlappedResult (get_handle (), &io_status, &n, FALSE)) + if (GetOverlappedResult (get_handle (), &io_status, &n, TRUE)) tot = n; else if (GetLastError () != ERROR_OPERATION_ABORTED) goto err;