Hi, David wrote: > Ken wrote: > > I suggest we simply remove closefds() completely. ... > Ralph's suggestion of looking for only open fds addresses the > suboptimality of closefds(), though only for systems that use /proc.
That was just meant as a temporary debugging aid to see what was sneaking through. :-) I agree with the general principle that if we open it, we track it, and then close it so it doesn't reach the child, typically with O_CLOEXEC or FD_CLOEXEC. Calling close(2) lots of times based on getdtablesize(3) can take a while. screen(1) had a bug recently where it was taking ages trying to close almost 512 Ki of them. https://lists.archlinux.org/pipermail/arch-general/2019-March/046214.html I don't think there's any multi-threading in nmh so we just have what's open at the time of fork(2) to deal with. -- Cheers, Ralph. -- nmh-workers https://lists.nongnu.org/mailman/listinfo/nmh-workers
