From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 19 05:15:33 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58E1A106564A for ; Mon, 19 Jul 2010 05:15:33 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 23F618FC15 for ; Mon, 19 Jul 2010 05:15:32 +0000 (UTC) Received: by iwn35 with SMTP id 35so5316515iwn.13 for ; Sun, 18 Jul 2010 22:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:cc:content-type; bh=fXcLHm72/oFiNGnxKlYy08uFM2gvEvfw1QhKLBR14To=; b=S2eLsibNge7X2HTA5sTruqEBdjKFcBI9z13gtXi1yfLylSx54B1aG2OK/XPDYwJYoq 3/d6wPZQ5NkHkDZeBIzF2BBYvYWXK0HrFJEmdIBt+4FIctrsWwtcauZeTDNI4kYx47bc t/yl3CDiWIZy/xK71I6h3j8rbxKdk6IK1kia8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=Nt+0P4yWYJqACwjH47rqQg7QUGTRjahqiVB4LFh0+5ldcu72wU4IKJvMxKXZzJyhJ4 S+087p9jMVrg6zFoQjtW7jqXf5DJoBOzorl4ardi28+dEPYIWNY6BzbWGD3CBQ5D44zR Zo/5dpuLOlHl2bdAMNi2V245/6ds+1KRSeOrY= MIME-Version: 1.0 Received: by 10.231.146.136 with SMTP id h8mr4980676ibv.0.1279516532402; Sun, 18 Jul 2010 22:15:32 -0700 (PDT) Received: by 10.231.169.18 with HTTP; Sun, 18 Jul 2010 22:15:32 -0700 (PDT) Date: Sun, 18 Jul 2010 22:15:32 -0700 Message-ID: From: Garrett Cooper To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: hackers@freebsd.org Subject: [PATCH] sigpause(2) doesn't check signal validity before setting mask X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2010 05:15:33 -0000 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)); }