From 036fd823dcf4cf161304a894258477d175b1c3f0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 8 Nov 2001 15:01:44 +0000 Subject: * select.cc (fhandler_tty_slave::ready_for_read): Return 0 on EBADF. * syscalls.cc (_read): If ready_for_read() failed, save errno from being overwritten by signal handler call. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/select.cc | 2 +- winsup/cygwin/syscalls.cc | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 78e345e..12a6578 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2001-11-08 Corinna Vinschen + + * select.cc (fhandler_tty_slave::ready_for_read): Return 0 on EBADF. + * syscalls.cc (_read): If ready_for_read() failed, save errno from + being overwritten by signal handler call. + 2001-11-07 Corinna Vinschen * lib/getopt.c (getopt_internal): Reset optind to 1 only if optreset diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 5058272..6639974 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -781,7 +781,7 @@ fhandler_tty_slave::ready_for_read (int fd, DWORD howlong) if (cygheap->fdtab.not_open (fd)) { set_errno (EBADF); - return 1; + return 0; } if (get_readahead_valid ()) { diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 3b2104d..fc069ca 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -314,6 +314,7 @@ _read (int fd, void *ptr, size_t len) debug_printf ("non-interruptible read\n"); else if (!cfd->ready_for_read (fd, wait)) { + set_sig_errno (get_errno ()); res = -1; goto out; } -- cgit v1.1