diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index abaf88903..ee21390be 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Wed Sep 12 01:03:36 2001 Christopher Faylor + + * exceptions.cc (call_signal_handler_now): Add additional guard against + inappropriately calling signal handler. + * syscalls.cc (_read): Reset errno if not exiting due to signal. + Wed Sep 12 13:03:00 2001 Robert Collins * autoload.cc (LoadDLLfuncEx): Auto load TryEnterCriticalSection - it's diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index bf4a4446e..37607cd8e 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1127,6 +1127,12 @@ extern "C" { static int __stdcall call_signal_handler_now () { + if (!sigsave.sig) + { + sigproc_printf ("call_signal_handler_now called when no signal active"); + return 0; + } + int sa_flags = sigsave.sa_flags; sigproc_printf ("sa_flags %p", sa_flags); *sigsave.retaddr_on_stack = sigsave.retaddr; diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 3359c352e..e9ee64d81 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -275,6 +275,7 @@ _read (int fd, void *ptr, size_t len) int res; fhandler_base *fh; extern int sigcatchers; + int e = get_errno (); while (1) { @@ -318,6 +319,7 @@ _read (int fd, void *ptr, size_t len) out: if (res >= 0 || get_errno () != EINTR || !thisframe.call_signal_handler ()) break; + set_errno (e); } syscall_printf ("%d = read (%d<%s>, %p, %d), bin %d, errno %d", res, fd, fh->get_name (),