public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: serial: avoid overrun of vtime
Date: Thu, 26 Mar 2020 11:26:31 +0000 (GMT) [thread overview]
Message-ID: <20200326112631.AEA63385E01A@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=72294cd21175c307a6552416b249fc8d66ee0bbc
commit 72294cd21175c307a6552416b249fc8d66ee0bbc
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Sat Mar 21 10:36:11 2020 +0100
Cygwin: serial: avoid overrun of vtime
After changing the type of fhandler_serial::vtime_ to cc_t, vtime_
must be stored in 10s of seconds, not in milliseconds.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/fhandler_serial.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
index 72cb1678d..66e80197b 100644
--- a/winsup/cygwin/fhandler_serial.cc
+++ b/winsup/cygwin/fhandler_serial.cc
@@ -903,7 +903,7 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
}
else
{
- vtime_ = t->c_cc[VTIME] * 100;
+ vtime_ = t->c_cc[VTIME];
vmin_ = t->c_cc[VMIN];
}
@@ -925,13 +925,13 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
{
/* set timeoout constant appropriately and we will only try to
read one character in ReadFile() */
- to.ReadTotalTimeoutConstant = vtime_;
+ to.ReadTotalTimeoutConstant = vtime_ * 100;
to.ReadIntervalTimeout = to.ReadTotalTimeoutMultiplier = MAXDWORD;
}
else if ((vmin_ > 0) && (vtime_ > 0))
{
/* time applies to the interval time for this case */
- to.ReadIntervalTimeout = vtime_;
+ to.ReadIntervalTimeout = vtime_ * 100;
}
else if ((vmin_ == 0) && (vtime_ == 0))
{
@@ -1138,7 +1138,7 @@ fhandler_serial::tcgetattr (struct termios *t)
if (!wbinary ())
t->c_oflag |= ONLCR;
- t->c_cc[VTIME] = vtime_ / 100;
+ t->c_cc[VTIME] = vtime_;
t->c_cc[VMIN] = vmin_;
debug_printf ("vmin_ %u, vtime_ %u", vmin_, vtime_);
reply other threads:[~2020-03-26 11:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200326112631.AEA63385E01A@sourceware.org \
--to=corinna@sourceware.org \
--cc=cygwin-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).