Mail Archives: djgpp-workers/1997/06/03/18:03:31
Eli Zaretskii wrote:
> Solutions? I can think of two:
>
> a) Change low-level libc functions so that they open files with a
> non-inherit bit. It is a rare program that really needs this on MS-DOS,
> most of the handles beyond the first 5 don't need to be inherited (in
> fact, first thing that COMMAND.COM does when it starts is to close all
> handles from 6 on). If we NEVER need the inheritance, this is the best
> solution. However, I'm afraid that Bash relies on the inheritance
> sometimes (to support constructs like "6> foo"), and other programs might
> need this too. Can anybody comment on this?
This would probably be a good solution so long as any files that NEED to
be
inherited can. (a flag to open?)
>
> b) The second way is a bit kludgy but safer, I think. We can
> reserve a couple of handles in the first 20 and close them in the code
> that invokes child programs, so that at least a few handles are free on
> the child side. When the child returns, we just reopen them (say, on NUL
> device).
very hacky and kludgy. I think a would be better so long as the
programmer
has control. Yes, this can cause some subtle bugs, but it is rare for
anything
but the first 5 handles to be inherited anyway.
Bill
--
Leave others their otherness.
- Raw text -