From 5ebe96648bcec067b428315b455b16b6b026df06 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 12 Jul 2010 10:14:24 +0000 Subject: [PATCH] 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 MFC after: 1 week --- lib/libc/compat-43/sigcompat.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c index c3ba30a41f4..6841eeb2461 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 +#include #include #include #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)); }