From owner-svn-src-stable@FreeBSD.ORG Mon Feb 8 15:50:51 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDDA8106566B; Mon, 8 Feb 2010 15:50:51 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDBCA8FC12; Mon, 8 Feb 2010 15:50:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o18Fopgi087063; Mon, 8 Feb 2010 15:50:51 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o18FopI0087061; Mon, 8 Feb 2010 15:50:51 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201002081550.o18FopI0087061@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 8 Feb 2010 15:50:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203667 - stable/8/usr.bin/truss X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2010 15:50:52 -0000 Author: jh Date: Mon Feb 8 15:50:51 2010 New Revision: 203667 URL: http://svn.freebsd.org/changeset/base/203667 Log: MFC r200752: Avoid sharing the file descriptor of the output file with traced processes by setting the FD_CLOEXEC flag for the output file. PR: bin/140493 Modified: stable/8/usr.bin/truss/main.c Directory Properties: stable/8/usr.bin/truss/ (props changed) Modified: stable/8/usr.bin/truss/main.c ============================================================================== --- stable/8/usr.bin/truss/main.c Mon Feb 8 15:48:18 2010 (r203666) +++ stable/8/usr.bin/truss/main.c Mon Feb 8 15:50:51 2010 (r203667) @@ -239,6 +239,12 @@ main(int ac, char **av) if ((trussinfo->outfile = fopen(fname, "w")) == NULL) errx(1, "cannot open %s", fname); } + /* + * Set FD_CLOEXEC, so that the output file is not shared with + * the traced process. + */ + if (fcntl(fileno(trussinfo->outfile), F_SETFD, FD_CLOEXEC) == -1) + warn("fcntl()"); /* * If truss starts the process itself, it will ignore some signals --