diff options
author | kib <kib@FreeBSD.org> | 2010-07-12 10:14:24 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-07-12 10:14:24 +0000 |
commit | 62d3ab3ec89fd724f8db94cd218a9681098ffda9 (patch) | |
tree | 1f52ce1a852063bbdf06008bc89c94a0e8e6b55b /lib/libc/compat-43/sigcompat.c | |
parent | 3f954c1b25a408043ef3495710d9606d970b427b (diff) | |
download | FreeBSD-src-62d3ab3ec89fd724f8db94cd218a9681098ffda9.zip FreeBSD-src-62d3ab3ec89fd724f8db94cd218a9681098ffda9.tar.gz |
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
Diffstat (limited to 'lib/libc/compat-43/sigcompat.c')
-rw-r--r-- | lib/libc/compat-43/sigcompat.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c index c3ba30a..6841eeb 100644 --- a/lib/libc/compat-43/sigcompat.c +++ b/lib/libc/compat-43/sigcompat.c @@ -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)); } |