On Wed 06 Jan 2016 at 17:44:45 +0000, Taylor R Campbell wrote:
This only fixes the problem for certain orderings of file descriptors.
I was thinking of a different hack.
Given tha filemon now knows there are issues if it has to use a fd lower
than its own fd, it can avoid the situation.
If it happens, it might dup2() the output fd so that it gets one that is
high enough, to use instead. That ought to work, since as I understand
the issue is references to the file descriptor, not references to the
file structure.
Of course I can immediately see some disadvantages to this apprroach:
- this will use an extra fd and that is observable by the process
- and the process might even close that fd if it is doing some blanket
close-all-fds action.
Maybe these potential issues can be avoided somehow?