Date: Tue, 15 Mar 2016 17:05:28 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> 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 Message-ID: <201603151705.u2FH5SD9005652@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 (;;) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603151705.u2FH5SD9005652>