* 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.
This commit is contained in:
Christopher Faylor 2002-11-05 23:15:04 +00:00
parent 2f5e9ace2e
commit 087a28bf5e
3 changed files with 17 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2002-11-05 Sergey Okhapkin <sos@prospect.com.ru>
* 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.
2002-11-05 Thomas Pfaff <tpfaff@gmx.net>
* fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL

View File

@ -626,7 +626,7 @@ class fhandler_cygdrive: public fhandler_disk_file
class fhandler_serial: public fhandler_base
{
private:
unsigned int vmin_; /* from termios */
size_t vmin_; /* from termios */
unsigned int vtime_; /* from termios */
pid_t pgrp_;
int rts; /* for Windows 9x purposes only */

View File

@ -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;