[newlib-cygwin] Cygwin: console: Fix a bug from comparison between int and DWORD.

Takashi Yano tyan0@sourceware.org
Wed Mar 2 02:18:00 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=312dc2289ce160016ded9eeec16b9dff7c16f7f2

commit 312dc2289ce160016ded9eeec16b9dff7c16f7f2
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Wed Mar 2 11:08:27 2022 +0900

    Cygwin: console: Fix a bug from comparison between int and DWORD.

Diff:
---
 winsup/cygwin/fhandler_console.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 7e51ea19e..7693ab8e4 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -1274,7 +1274,7 @@ out:
     {
       DWORD discarded;
       ReadConsoleInputW (get_handle (), input_rec, discard_len, &discarded);
-      con.num_processed = max (con.num_processed - discarded, 0);
+      con.num_processed -= min (con.num_processed, discarded);
     }
   return stat;
 }


More information about the Cygwin-cvs mailing list