This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: More fhandler_serial fixes.
Sure!
Index: fhandler_serial.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_serial.cc,v
retrieving revision 1.32
diff -u -p -r1.32 fhandler_serial.cc
--- fhandler_serial.cc 4 Nov 2002 04:09:14 -0000 1.32
+++ fhandler_serial.cc 5 Nov 2002 21:45:52 -0000
@@ -43,7 +43,7 @@ fhandler_serial::raw_read (void *ptr, si
int tot;
DWORD n;
HANDLE w4[2];
- DWORD minchars = vmin_ ?: ulen;
+ size_t minchars = vmin_ ?vmin_: ulen;
w4[0] = io_status.hEvent;
w4[1] = signal_arrived;
@@ -387,8 +387,11 @@ fhandler_serial::ioctl (unsigned int cmd
DWORD ev;
COMSTAT st;
- if (ClearCommError (get_handle (), &ev, &st))
- res = -1;
+ if (ClearCommError (get_handle (), &ev, &st) == 0)
+ {
+ __seterrno ();
+ res = -1;
+ }
else
switch (cmd)
{
@@ -423,20 +426,21 @@ fhandler_serial::ioctl (unsigned int cmd
0, &mcr, 4, &cb, 0);
if (!result)
{
- __seterrno ();
- res = -1;
- goto out;
+ modem_status |= rts | dtr;
}
- if (cb != 4)
+ else
{
- set_errno (EINVAL); /* FIXME: right errno? */
- res = -1;
- goto out;
+ if (cb != 4)
+ {
+ set_errno (EINVAL); /* FIXME: right errno? */
+ res = -1;
+ goto out;
+ }
+ if (mcr & 2)
+ modem_status |= TIOCM_RTS;
+ if (mcr & 1)
+ modem_status |= TIOCM_DTR;
}
- if (mcr & 2)
- modem_status |= TIOCM_RTS;
- if (mcr & 1)
- modem_status |= TIOCM_DTR;
}
ipbuffer = modem_status;
}
@@ -794,7 +798,7 @@ fhandler_serial::tcsetattr (int action,
if (t->c_lflag & ICANON)
{
- vmin_ = MAXDWORD;
+ vmin_ = 0;
vtime_ = 0;
}
else
@@ -999,7 +1003,7 @@ fhandler_serial::tcgetattr (struct termi
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;
Sergey Okhapkin
Somerset, NJ
----- Original Message -----
From: "Christopher Faylor" <cgf@redhat.com>
To: <cygwin-patches@cygwin.com>
Sent: Tuesday, November 05, 2002 5:28 PM
Subject: Re: More fhandler_serial fixes.
> On Tue, Nov 05, 2002 at 04:54:19PM -0500, Sergey Okhapkin wrote:
> >The patch fixes sume bugs/typos in fhandler_serial
> >
> >2002-11-03 Sergey Okhapkin <sos@prospect.com.ru>
> >
> > * fhandler_serial.cc (fhandler_serial::raw_read): Use correct
type,
> >fix typo.
> > (fhandler_serial::ioctl): Fix ClearCommError() return value
check,
> > set errno if the call failed.
> > Don't give up if DeviceIoCtl() failed, but fall back to Win95
> >method.
> > (fhandler_serial::tcsetattr): Use correct value for vmin_.
> > (fhandler_serial::tcgetattr): Ditto.
>
> Is there any way that you could send this as regular text or even as an
> attachment. It's hard to respond to patches when they're uunencoded.
>
> cgf
>
> >begin 666 fhandler_serial.cc.diff