Index: termios.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/termios.cc,v retrieving revision 1.26 diff -u -p -r1.26 termios.cc --- termios.cc 28 Nov 2003 20:55:58 -0000 1.26 +++ termios.cc 12 Dec 2003 19:04:37 -0000 @@ -33,14 +33,12 @@ tcsendbreak (int fd, int duration) cygheap_fdget cfd (fd); if (cfd < 0) - goto out; - - if (!cfd->is_tty ()) + set_errno (EBADF); + else if (!cfd->is_tty ()) set_errno (ENOTTY); else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof) res = cfd->tcsendbreak (duration); -out: syscall_printf ("%d = tcsendbreak (%d, %d)", res, fd, duration); return res; } @@ -55,14 +53,12 @@ tcdrain (int fd) cygheap_fdget cfd (fd); if (cfd < 0) - goto out; - - if (!cfd->is_tty ()) + set_errno (EBADF); + else if (!cfd->is_tty ()) set_errno (ENOTTY); else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof) res = cfd->tcdrain (); -out: syscall_printf ("%d = tcdrain (%d)", res, fd); return res; } @@ -75,16 +71,14 @@ tcflush (int fd, int queue) cygheap_fdget cfd (fd); if (cfd < 0) - goto out; - - if (!cfd->is_tty ()) + set_errno (EBADF); + else if (!cfd->is_tty ()) set_errno (ENOTTY); else if (queue != TCIFLUSH && queue != TCOFLUSH && queue != TCIOFLUSH) - set_errno (EINVAL); + set_errno (EINVAL); else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof) res = cfd->tcflush (queue); -out: termios_printf ("%d = tcflush (%d, %d)", res, fd, queue); return res; } @@ -97,14 +91,12 @@ tcflow (int fd, int action) cygheap_fdget cfd (fd); if (cfd < 0) - goto out; - - if (!cfd->is_tty ()) + set_errno (EBADF); + else if (!cfd->is_tty ()) set_errno (ENOTTY); else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof) res = cfd->tcflow (action); -out: syscall_printf ("%d = tcflow (%d, %d)", res, fd, action); return res; }