For xsi_sigpause(3), remove the supplied signal from the process mask

during sigpause(2) call. It was backward.
Check that the signal number is valid.

Reported by:	Garrett Cooper <yanegomi gmail com>
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2010-07-12 10:14:24 +00:00
parent 160f3477ee
commit 5ebe96648b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=209932

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/param.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include "un-namespace.h"
@ -111,9 +112,16 @@ int
xsi_sigpause(int sig)
{
sigset_t set;
int error;
sigemptyset(&set);
sigaddset(&set, sig);
if (!_SIG_VALID(sig)) {
errno = EINVAL;
return (-1);
}
error = _sigprocmask(SIG_BLOCK, NULL, &set);
if (error != 0)
return (error);
sigdelset(&set, sig);
return (_sigsuspend(&set));
}