* 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.
This commit is contained in:
Corinna Vinschen 2005-03-09 21:07:56 +00:00
parent b364b39867
commit fa4b5b03c0
2 changed files with 13 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2005-03-08 Corinna Vinschen <corinna@vinschen.de>
* 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 <cgf@timesys.com>
* net.cc (dup_ent): Avoid dereferencing a null pointer in a debug_printf.

View File

@ -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);
}