]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: serial: avoid overrun of vtime
authorCorinna Vinschen <corinna@vinschen.de>
Sat, 21 Mar 2020 09:36:11 +0000 (10:36 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Sun, 22 Mar 2020 14:15:19 +0000 (15:15 +0100)
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>
winsup/cygwin/fhandler_serial.cc

index 72cb1678d392be2f08ce05c6d247eda51327064f..66e80197be0e7a86682d585dad96b4417f767c5d 100644 (file)
@@ -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_);
This page took 0.035278 seconds and 5 git commands to generate.