Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jul 2010 22:15:32 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        hackers@freebsd.org
Subject:   [PATCH] sigpause(2) doesn't check signal validity before setting mask
Message-ID:  <AANLkTim-ztL4IenTmDCMvfIiceCM3ExrP7JpjTSCgaqY@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
    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));
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim-ztL4IenTmDCMvfIiceCM3ExrP7JpjTSCgaqY>