* 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.
This commit is contained in:
Christopher Faylor 2001-09-12 05:09:24 +00:00
parent ff6e295ebf
commit aed6988a36
3 changed files with 14 additions and 0 deletions

View File

@ -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> Wed Sep 12 13:03:00 2001 Robert Collins <rbtcollins@hotmail.com>
* autoload.cc (LoadDLLfuncEx): Auto load TryEnterCriticalSection - it's * autoload.cc (LoadDLLfuncEx): Auto load TryEnterCriticalSection - it's

View File

@ -1127,6 +1127,12 @@ extern "C" {
static int __stdcall static int __stdcall
call_signal_handler_now () 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; int sa_flags = sigsave.sa_flags;
sigproc_printf ("sa_flags %p", sa_flags); sigproc_printf ("sa_flags %p", sa_flags);
*sigsave.retaddr_on_stack = sigsave.retaddr; *sigsave.retaddr_on_stack = sigsave.retaddr;

View File

@ -275,6 +275,7 @@ _read (int fd, void *ptr, size_t len)
int res; int res;
fhandler_base *fh; fhandler_base *fh;
extern int sigcatchers; extern int sigcatchers;
int e = get_errno ();
while (1) while (1)
{ {
@ -318,6 +319,7 @@ _read (int fd, void *ptr, size_t len)
out: out:
if (res >= 0 || get_errno () != EINTR || !thisframe.call_signal_handler ()) if (res >= 0 || get_errno () != EINTR || !thisframe.call_signal_handler ())
break; break;
set_errno (e);
} }
syscall_printf ("%d = read (%d<%s>, %p, %d), bin %d, errno %d", res, fd, fh->get_name (), syscall_printf ("%d = read (%d<%s>, %p, %d), bin %d, errno %d", res, fd, fh->get_name (),