From owner-svn-src-all@FreeBSD.ORG Tue Jan 10 21:40:20 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 193E91065741; Tue, 10 Jan 2012 21:40:20 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id 914898FC1C; Tue, 10 Jan 2012 21:40:19 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q0ALeI8K035557; Tue, 10 Jan 2012 15:40:18 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q0ALeC55022958 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 10 Jan 2012 15:40:14 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q0ALeC55022958 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1326231615; bh=NCISRWPevMHqBphtFpnkE5B/ryqCvBmRVCL+LxBotyU=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=HtYQmRz/1QG84clyoYmvXNum7NYZkqipmZuR4fQo8E5w/URIrs6xkx4DxMDwvcGdP p3zWROblFmRXk7PfF1/VCpv+HWDl6yarq1V8KbaYYj9m7j3umCGLGcE/WDcdIw//5H 9eooJxg4kebKNn4Xpm9x/ULr+ezMOiKppu2Dq8EU= Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Guy Helmer In-Reply-To: <20120110212710.GB1694@garage.freebsd.pl> Date: Tue, 10 Jan 2012 15:39:54 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <2C686047-0D47-4B29-A78A-3D1240953F41@palisadesystems.com> References: <201201101843.q0AIhRuM022949@svn.freebsd.org> <20120110212525.GA1694@garage.freebsd.pl> <20120110212710.GB1694@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Tue, 10 Jan 2012 15:40:15 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q0ALeC55022958 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-1.628, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229936 - head/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 21:40:20 -0000 On Jan 10, 2012, at 3:27 PM, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 10:25:26PM +0100, Pawel Jakub Dawidek wrote: >> On Tue, Jan 10, 2012 at 06:43:27PM +0000, Guy Helmer wrote: >>> Author: ghelmer >>> Date: Tue Jan 10 18:43:27 2012 >>> New Revision: 229936 >>> URL: http://svn.freebsd.org/changeset/base/229936 >>>=20 >>> Log: >>> Set the FD_CLOEXEC flag on the open pidfile file descriptor. >>>=20 >>> Discussed with: pjd, des >>=20 >> Could you also update manual page to note that pidfile_open(3) can = now >> also set errno via fcntl(2)? >=20 > Actually, it would also be useful to document the fact that we now set > FD_CLOEXEC flag, so one doesn't have to look at the code to find it. Thanks for reminding me, I mean to do that earlier. Guy >=20 >>> Modified: >>> head/lib/libutil/pidfile.c >>>=20 >>> Modified: head/lib/libutil/pidfile.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libutil/pidfile.c Tue Jan 10 18:20:19 2012 = (r229935) >>> +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 = (r229936) >>> @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo >>> free(pfh); >>> return (NULL); >>> } >>> + >>> + /* >>> + * Prevent the file descriptor from escaping to other >>> + * programs via exec(3). >>> + */ >>> + if (fcntl(fd, F_SETFD, FD_CLOEXEC) =3D=3D -1) { >>> + error =3D errno; >>> + unlink(pfh->pf_path); >>> + close(fd); >>> + free(pfh); >>> + errno =3D error; >>> + return (NULL); >>> + } >>> + >>> /* >>> * Remember file information, so in pidfile_write() we are sure = we write >>> * to the proper descriptor. >=20 > --=20 > Pawel Jakub Dawidek http://www.wheelsystems.com > FreeBSD committer http://www.FreeBSD.org > Am I Evil? Yes, I Am! http://yomoli.com -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure.