summaryrefslogtreecommitdiff
path: root/lib/replace/closefrom.c
AgeCommit message (Collapse)AuthorFilesLines
2020-11-04libreplace: Compare a pointer against NULL, not 0Volker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-06-13libreplace: Add a closefrom() implementationVolker Lendecke1-0/+138
There is closefrom in some BSDs, but Linux ships this only as part of libbsd. Add a new implementation of it in libreplace. The one in libbsd of jessie and upstream differ and it has for example optimizations for FreeBSD, but it gets some of the array calculations slightly wrong from my point of view. If you want those, use libbsd. This replacement is optimized on Linux only looking at /proc/self/fd/, everything else would do the OPEN_MAX brute force fallback. Signed-off-by: Volker Lendecke <vl@samba.org>