Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2020-03-02 19:02:51 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-03-02 19:05:59 +0300
commit1b7fcf22bea529fba920310dcd2db144bb24ccc6 (patch)
treeb4cc25fcd61e0ea4358e0c63ecef12c9c2605ae0 /winsup/cygwin/fhandler_serial.cc
parentcef36220f247e02847ee4f39790b7debcc50a36b (diff)
Cygwin: ioctl: TIOCINQ: always return number of chars in the inbound queue
So far ioctl(TIOCINQ) could end up returning -1 with errno set to EINVAL if a non-zero device error mask has been returned by ClearCommError. This doesn't reflect Linux behaviour, which always returns the number of chars in the inbound queue, independent of any I/O error condition. EINVAL was a pretty weird error code to use in this scenario, too. Fix this by dropping all checking for device errors in the TIOCINQ case. Just return the number of chars in the inbound queue. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/fhandler_serial.cc')
-rw-r--r--winsup/cygwin/fhandler_serial.cc9
1 files changed, 1 insertions, 8 deletions
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
index 615b2513f..69e5768f6 100644
--- a/winsup/cygwin/fhandler_serial.cc
+++ b/winsup/cygwin/fhandler_serial.cc
@@ -519,14 +519,7 @@ fhandler_serial::ioctl (unsigned int cmd, void *buf)
}
break;
case TIOCINQ:
- if (ev & CE_FRAME || ev & CE_IOE || ev & CE_OVERRUN || ev & CE_RXOVER
- || ev & CE_RXPARITY)
- {
- set_errno (EINVAL); /* FIXME: Use correct errno */
- res = -1;
- }
- else
- ipbuf = st.cbInQue;
+ ipbuf = st.cbInQue;
break;
case TIOCGWINSZ:
((struct winsize *) buf)->ws_row = 0;