Re:Fork() without exec() is dangerous in large programs (2016)
by asveikau on Tuesday June 14, 2022 @05:46PM
(#31746475)
closefrom() comes in handy for this. It's missing on some platforms (notably glibc and mac iirc) but actually not too hard to implement a work-alike.
[ Parent
| on HN ]
Re:Fork() without exec() is dangerous in large programs (2016)
by cryptonector on Tuesday June 14, 2022 @06:30PM
(#31746845)
I've copied a closefrom() many a time.
A common hack I've had to add is an argument FD that is not to be closed because. e.g., an flock is held on it.