3 ms·
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.
by asveikau 4y ago
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.
- cryptonector 4y agoI'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.