[PATCH] Cygwin: console: Fix argument of process_input_message() in read()

Takashi Yano <[email protected]>
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
The commit fac73911f5a0 ("Cygwin: console: Fix typeahead input for
bash") introduced an argument to process_input_message() to restict
the maximum length to be processed by this function. However, the
commit failed to account for the number of chars already copied into
the buffer.  This patch corrects the argument to process_input_message()
to address this issue.

Fixes: fac73911f5a0 ("Cygwin: console: Fix typeahead input for bash")
Signed-off-by: Takashi Yano <[email protected]>
Reviewed-by:
---
 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 e349afe9c..f04cb1b48 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -1367,7 +1367,7 @@ wait_retry:
 
       int ret;
       acquire_input_mutex (mutex_timeout);
-      ret = process_input_message (buflen);
+      ret = process_input_message (buflen - copied_chars);
       switch (ret)
 	{
 	case input_error:
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.