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:
authorChristopher Faylor <me@cgf.cx>2002-11-06 02:15:04 +0300
committerChristopher Faylor <me@cgf.cx>2002-11-06 02:15:04 +0300
commit087a28bf5e1b8248ea6c7ba258609a6c68cb4920 (patch)
treef0749aeb605a78ff798c90e8b52f38f25e25b1fe /winsup/cygwin/fhandler_serial.cc
parent2f5e9ace2e4ed4fdfad232f61a554926e74dcf46 (diff)
* fhandler_serial.cc (fhandler_serial::raw_read): Use correct type for
minchars. (fhandler_serial::ioctl): Set errno if the ClearCommError fails. (fhandler_serial::tcsetattr): Use correct value for vmin_. (fhandler_serial::tcgetattr): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_serial.cc')
-rw-r--r--winsup/cygwin/fhandler_serial.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
index 99a1b3d6b..c12d23d02 100644
--- a/winsup/cygwin/fhandler_serial.cc
+++ b/winsup/cygwin/fhandler_serial.cc
@@ -43,7 +43,7 @@ fhandler_serial::raw_read (void *ptr, size_t ulen)
int tot;
DWORD n;
HANDLE w4[2];
- DWORD minchars = vmin_ ?: ulen;
+ size_t minchars = vmin_ ?: ulen;
w4[0] = io_status.hEvent;
w4[1] = signal_arrived;
@@ -81,7 +81,7 @@ fhandler_serial::raw_read (void *ptr, size_t ulen)
inq = st.cbInQue;
else if (!overlapped_armed)
{
- if ((size_t)tot >= minchars)
+ if ((size_t) tot >= minchars)
break;
else if (WaitCommEvent (get_handle (), &ev, &io_status))
{
@@ -388,7 +388,10 @@ fhandler_serial::ioctl (unsigned int cmd, void *buffer)
DWORD ev;
COMSTAT st;
if (ClearCommError (get_handle (), &ev, &st))
- res = -1;
+ {
+ __seterrno ();
+ res = -1;
+ }
else
switch (cmd)
{
@@ -397,7 +400,7 @@ fhandler_serial::ioctl (unsigned int cmd, void *buffer)
break;
case TIOCMGET:
DWORD modem_lines;
- if (GetCommModemStatus (get_handle (), &modem_lines) == 0)
+ if (!GetCommModemStatus (get_handle (), &modem_lines))
{
__seterrno ();
res = -1;
@@ -794,7 +797,7 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
if (t->c_lflag & ICANON)
{
- vmin_ = MAXDWORD;
+ vmin_ = 0;
vtime_ = 0;
}
else
@@ -999,7 +1002,7 @@ fhandler_serial::tcgetattr (struct termios *t)
t->c_oflag |= ONLCR;
debug_printf ("vmin_ %d, vtime_ %d", vmin_, vtime_);
- if (vmin_ == MAXDWORD)
+ if (vmin_ == 0)
{
t->c_lflag |= ICANON;
t->c_cc[VTIME] = t->c_cc[VMIN] = 0;