diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 78e345ec5..12a6578e8 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 50582727d..663997446 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 3b2104d7f..fc069ca73 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; }