diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2016-03-15 19:45:24 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2016-03-15 19:45:24 +0000 |
commit | 3b2ab8b89b525fe415be72fdf3de5e59aedc0331 (patch) | |
tree | 8c5e9bbf7568db53c85e447edda22da35856a27b /usr.bin | |
parent | e0876678225fefb06262986143b5f67ae37c9d22 (diff) | |
download | FreeBSD-src-3b2ab8b89b525fe415be72fdf3de5e59aedc0331.zip FreeBSD-src-3b2ab8b89b525fe415be72fdf3de5e59aedc0331.tar.gz |
MFS r296911:
Filemon: Attach from the child to avoid racing with the parent attach.
Relnotes: yes
Approved by: re (marius)
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/script/script.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 4e5e313..1fb79f3 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -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 (;;) { |