Fix return value for setcontext and swapcontext.

This commit is contained in:
David Xu 2013-05-09 04:41:03 +00:00
parent bc1062559e
commit 66f6c2721d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250402

View File

@ -725,8 +725,10 @@ _setcontext(const ucontext_t *ucp)
{
ucontext_t uc;
if (ucp == NULL)
return (EINVAL);
if (ucp == NULL) {
errno = EINVAL;
return (-1);
}
if (!SIGISMEMBER(uc.uc_sigmask, SIGCANCEL))
return __sys_setcontext(ucp);
(void) memcpy(&uc, ucp, sizeof(uc));
@ -740,8 +742,10 @@ _swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
{
ucontext_t uc;
if (oucp == NULL || ucp == NULL)
return (EINVAL);
if (oucp == NULL || ucp == NULL) {
errno = EINVAL;
return (-1);
}
if (SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL)) {
(void) memcpy(&uc, ucp, sizeof(uc));
SIGDELSET(uc.uc_sigmask, SIGCANCEL);