Index: cygwin/fhandler_serial.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/fhandler_serial.cc,v retrieving revision 1.40 diff -u -p -r1.40 fhandler_serial.cc --- cygwin/fhandler_serial.cc 10 Jan 2003 12:32:46 -0000 1.40 +++ cygwin/fhandler_serial.cc 17 Jan 2003 06:37:03 -0000 @@ -725,8 +725,13 @@ fhandler_serial::tcsetattr (int action, state.fAbortOnError = TRUE; - if (memcmp (&ostate, &state, sizeof (state)) != 0) - SetCommState (get_handle (), &state); + if ((memcmp (&ostate, &state, sizeof (state)) != 0) && + !SetCommState (get_handle (), &state)) + { + /* SetCommState() failed, invalid DCB param (EINVAL in POSIX)*/ + set_errno (EINVAL); + return -1; + } set_r_binary ((t->c_iflag & IGNCR) ? 0 : 1); set_w_binary ((t->c_oflag & ONLCR) ? 0 : 1);