aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-09-09 03:00:34 +0000
committerChristopher Faylor <me@cgf.cx>2005-09-09 03:00:34 +0000
commit270bbd4e249938a2ccdbcec90af46ce56793fad3 (patch)
tree4e086885cd4e87c52fb96fa27d1cce665447d48d
parentc0df672fa07d54e1dae5fd3b41f5a704e9080801 (diff)
downloadnewlib-270bbd4e249938a2ccdbcec90af46ce56793fad3.zip
newlib-270bbd4e249938a2ccdbcec90af46ce56793fad3.tar.gz
newlib-270bbd4e249938a2ccdbcec90af46ce56793fad3.tar.bz2
* fhandler_serial.cc (fhandler_serial::tcgetattr): Just zero c_cflag here
rather than clearing CBAUD after the fact.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler_serial.cc25
-rw-r--r--winsup/cygwin/termios.cc5
3 files changed, 19 insertions, 16 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4ad6347..034e350 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2005-09-08 Christopher Faylor <cgf@timesys.com>
+ * fhandler_serial.cc (fhandler_serial::tcgetattr): Just zero c_cflag
+ here rather than clearing CBAUD after the fact.
+
+2005-09-08 Christopher Faylor <cgf@timesys.com>
+
* fhandler_serial.cc (fhandler_serial::ioctl): Always return 0 for
window size.
* termios.cc (tcgetattr): Clear out baud part of c_cflag since it is
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
index f7f9d60..dcf4206 100644
--- a/winsup/cygwin/fhandler_serial.cc
+++ b/winsup/cygwin/fhandler_serial.cc
@@ -911,44 +911,45 @@ fhandler_serial::tcgetattr (struct termios *t)
/* for safety */
memset (t, 0, sizeof (*t));
+ t->c_cflag = 0;
/* -------------- Baud rate ------------------ */
switch (state.BaudRate)
{
case CBR_110:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B110;
+ t->c_ospeed = t->c_ispeed = B110;
break;
case CBR_300:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B300;
+ t->c_ospeed = t->c_ispeed = B300;
break;
case CBR_600:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B600;
+ t->c_ospeed = t->c_ispeed = B600;
break;
case CBR_1200:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B1200;
+ t->c_ospeed = t->c_ispeed = B1200;
break;
case CBR_2400:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B2400;
+ t->c_ospeed = t->c_ispeed = B2400;
break;
case CBR_4800:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B4800;
+ t->c_ospeed = t->c_ispeed = B4800;
break;
case CBR_9600:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B9600;
+ t->c_ospeed = t->c_ispeed = B9600;
break;
case CBR_19200:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B19200;
+ t->c_ospeed = t->c_ispeed = B19200;
break;
case CBR_38400:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B38400;
+ t->c_ospeed = t->c_ispeed = B38400;
break;
case CBR_57600:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B57600;
+ t->c_ospeed = t->c_ispeed = B57600;
break;
case CBR_115200:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B115200;
+ t->c_ospeed = t->c_ispeed = B115200;
break;
case 230400: /* CBR_230400 - not defined */
- t->c_cflag = t->c_ospeed = t->c_ispeed = B230400;
+ t->c_ospeed = t->c_ispeed = B230400;
break;
default:
/* Unsupported baud rate! */
diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc
index e6a6517..6e0ab3e 100644
--- a/winsup/cygwin/termios.cc
+++ b/winsup/cygwin/termios.cc
@@ -179,10 +179,7 @@ tcgetattr (int fd, struct termios *in_t)
else if (!cfd->is_tty ())
set_errno (ENOTTY);
else if ((res = cfd->tcgetattr (t)) == 0)
- {
- t->c_cflag &= ~CBAUD;
- __toapp_termios (in_t, t);
- }
+ __toapp_termios (in_t, t);
if (res)
termios_printf ("%d = tcgetattr (%d, %p)", res, fd, in_t);