From fa4b5b03c099874588435898e450f9bd70354bd7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 9 Mar 2005 21:07:56 +0000 Subject: [PATCH] * signal.cc (sigprocmask): Rename first parameter to "how". (handle_sigprocmask): Ditto. Check "how" for being a valid "how" value. Fix call order in case of wrong "how" value. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/signal.cc | 17 +++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 112e84c7d..d664f1c2d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2005-03-08 Corinna Vinschen + + * signal.cc (sigprocmask): Rename first parameter to "how". + (handle_sigprocmask): Ditto. Check "how" for being a valid "how" value. + Fix call order in case of wrong "how" value. + 2005-03-09 Christopher Faylor * net.cc (dup_ent): Avoid dereferencing a null pointer in a debug_printf. diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 81cc2e7ee..1808b2428 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -130,20 +130,20 @@ usleep (unsigned int useconds) } extern "C" int -sigprocmask (int sig, const sigset_t *set, sigset_t *oldset) +sigprocmask (int how, const sigset_t *set, sigset_t *oldset) { - return handle_sigprocmask (sig, set, oldset, myself->getsigmask ()); + return handle_sigprocmask (how, set, oldset, myself->getsigmask ()); } int __stdcall -handle_sigprocmask (int sig, const sigset_t *set, sigset_t *oldset, sigset_t& opmask) +handle_sigprocmask (int how, const sigset_t *set, sigset_t *oldset, sigset_t& opmask) { sig_dispatch_pending (); - /* check that sig is in right range */ - if (sig < 0 || sig >= NSIG) + /* check that how is in right range */ + if (how != SIG_BLOCK && how != SIG_UNBLOCK && how != SIG_SETMASK) { + syscall_printf ("Invalid how value %d", how); set_errno (EINVAL); - syscall_printf ("signal %d out of range", sig); return -1; } @@ -159,7 +159,7 @@ handle_sigprocmask (int sig, const sigset_t *set, sigset_t *oldset, sigset_t& op if (check_invalid_read_struct_errno (set)) return -1; sigset_t newmask = opmask; - switch (sig) + switch (how) { case SIG_BLOCK: /* add set to current mask */ @@ -173,9 +173,6 @@ handle_sigprocmask (int sig, const sigset_t *set, sigset_t *oldset, sigset_t& op /* just set it */ newmask = *set; break; - default: - set_errno (EINVAL); - return -1; } (void) set_signal_mask (newmask, opmask); } -- 2.43.5