Filemon: Attach from the child to avoid racing with the parent attach.
This is the same as how the bmake filemon usage works. This also fixes failed attach not properly flushing the TTY. MFC after: 1 week Relnotes: yes Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
26802705d3
commit
7b245cb846
@ -224,12 +224,18 @@ main(int argc, char *argv[])
|
||||
warn("fork");
|
||||
done(1);
|
||||
}
|
||||
if (child == 0)
|
||||
doshell(argv);
|
||||
close(slave);
|
||||
if (child == 0) {
|
||||
if (fflg) {
|
||||
int pid;
|
||||
|
||||
if (fflg && ioctl(fm_fd, FILEMON_SET_PID, &child) < 0)
|
||||
err(1, "Cannot set filemon PID");
|
||||
pid = getpid();
|
||||
if (ioctl(fm_fd, FILEMON_SET_PID, &pid) < 0)
|
||||
err(1, "Cannot set filemon PID");
|
||||
}
|
||||
|
||||
doshell(argv);
|
||||
}
|
||||
close(slave);
|
||||
|
||||
start = tvec = time(0);
|
||||
readstdin = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user