Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2020-03-21 12:36:11 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-03-22 17:15:19 +0300
commit72294cd21175c307a6552416b249fc8d66ee0bbc (patch)
treee0ca5a2329cb891152c79384b6bda58c908fc66c
parente4f9fc92ac613f0ae6cf44de7fdd6229c50168e4 (diff)
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>
-rw-r--r--winsup/cygwin/fhandler_serial.cc8
1 files 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_);