diff options
author | Christopher Faylor <me@cgf.cx> | 2001-09-12 05:09:24 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-09-12 05:09:24 +0000 |
commit | aed6988a36fc02261ad4deee685f0a3e75ed4cdf (patch) | |
tree | 409e174a2fd2929527a6333777fbc29aa1505b9d | |
parent | ff6e295ebf83b89fdcedce78362fd2d9e20e3c95 (diff) | |
download | newlib-aed6988a36fc02261ad4deee685f0a3e75ed4cdf.zip newlib-aed6988a36fc02261ad4deee685f0a3e75ed4cdf.tar.gz newlib-aed6988a36fc02261ad4deee685f0a3e75ed4cdf.tar.bz2 |
* 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.
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 6 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index abaf889..ee21390 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Wed Sep 12 01:03:36 2001 Christopher Faylor <cgf@cygnus.com> + + * 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 <rbtcollins@hotmail.com> * autoload.cc (LoadDLLfuncEx): Auto load TryEnterCriticalSection - it's diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index bf4a444..37607cd 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 3359c35..e9ee64d 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 (), |