MINOR: fd: Use closefrom() as my_closefrom() if supported.
Add a new option, USE_CLOSEFROM. If set, it is assumed the system provides
a closefrom() function, so use it.
It is only implicitely used on FreeBSD for now, it should work on
OpenBSD/NetBSD/DragonflyBSD/Solaris too, but as I have no such system to
test it, I'd rather leave it disabled by default. Users can add USE_CLOSEFROM
explicitely on their make command line to activate it.
diff --git a/Makefile b/Makefile
index e2c4d17..6c19d3d 100644
--- a/Makefile
+++ b/Makefile
@@ -374,6 +374,7 @@
USE_LIBCRYPT = implicit
USE_THREAD = implicit
USE_CPU_AFFINITY= implicit
+ USE_CLOSEFROM = implicit
else
ifeq ($(TARGET),osx)
# This is for Mac OS/X
@@ -682,6 +683,10 @@
endif
endif
+ifneq ($(USE_CLOSEFROM),)
+OPTIONS_CFLAGS += -DUSE_CLOSEFROM
+endif
+
ifneq ($(USE_LUA),)
check_lua_lib = $(shell echo "int main(){}" | $(CC) -o /dev/null -x c - $(2) -l$(1) 2>/dev/null && echo $(1))
check_lua_inc = $(shell if [ -d $(2)$(1) ]; then echo $(2)$(1); fi;)