From owner-svn-src-stable-10@freebsd.org Tue Mar 15 17:05:29 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D90DEAD13A5; Tue, 15 Mar 2016 17:05:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A92BF1587; Tue, 15 Mar 2016 17:05:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2FH5SHN005653; Tue, 15 Mar 2016 17:05:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2FH5SD9005652; Tue, 15 Mar 2016 17:05:28 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201603151705.u2FH5SD9005652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 15 Mar 2016 17:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r296911 - stable/10/usr.bin/script X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2016 17:05:30 -0000 Author: bdrewery Date: Tue Mar 15 17:05:28 2016 New Revision: 296911 URL: https://svnweb.freebsd.org/changeset/base/296911 Log: MFC r296524: Filemon: Attach from the child to avoid racing with the parent attach. Relnotes: yes Modified: stable/10/usr.bin/script/script.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/script/script.c ============================================================================== --- stable/10/usr.bin/script/script.c Tue Mar 15 15:53:37 2016 (r296910) +++ stable/10/usr.bin/script/script.c Tue Mar 15 17:05:28 2016 (r296911) @@ -221,13 +221,19 @@ main(int argc, char *argv[]) warn("fork"); done(1); } - if (child == 0) + if (child == 0) { + if (fflg) { + int pid; + + pid = getpid(); + if (ioctl(fm_fd, FILEMON_SET_PID, &pid) < 0) + err(1, "Cannot set filemon PID"); + } + doshell(argv); + } close(slave); - if (fflg && ioctl(fm_fd, FILEMON_SET_PID, &child) < 0) - err(1, "Cannot set filemon PID"); - start = tvec = time(0); readstdin = 1; for (;;) {