[PATCH] sigpause(2) doesn't check signal validity before setting mask

Garrett Cooper yanegomi at gmail.com
Mon Jul 19 05:15:33 UTC 2010


    The following patch fixes the case where the value for sigmask
specified is invalid (to match the requirements stated in the manpage
and POSIX), and also converts the parameter name -- mask -- to match
the manpage.
Thanks,
-Garrett

Index: compat-43/sigcompat.c
===================================================================
--- compat-43/sigcompat.c	(revision 210226)
+++ compat-43/sigcompat.c	(working copy)
@@ -99,12 +99,16 @@
 }

 int
-sigpause(int mask)
+sigpause(int sigmask)
 {
 	sigset_t set;

+	if (!_SIG_VALID(sigmask)) {
+		errno = EINVAL;
+		return (-1);
+	}
 	sigemptyset(&set);
-	set.__bits[0] = mask;
+	set.__bits[0] = sigmask;
 	return (_sigsuspend(&set));
 }


More information about the freebsd-hackers mailing list