[echo 'configure: cannot find needed function.'; exit 1]
)
+AC_CHECK_DECL(
+ F_CLOSEM,
+ AC_DEFINE(HAVE_FCNTL_F_CLOSEM),
+ ,
+ [#include <fcntl.h>]
+)
+
AC_CHECK_FUNC(closefrom, [AC_DEFINE(HAVE_CLOSEFROM, 1, [Define to 1 if you have the 'closefrom' function.])])
AC_CHECK_FUNCS(getpagesize, [AC_DEFINE(HAVE_GETPAGESIZE, 1, [Set if have getpagesize])])
AC_CHECK_FUNCS(malloc_trim, [AC_DEFINE(HAVE_MALLOC_TRIM, 1, [Set if have malloc_trim])])
low_fd = 2; /* don't close debug output */
}
-#ifdef HAVE_CLOSEFROM
+#if defined(HAVE_FCNTL_F_CLOSEM)
+ /*
+ * fcntl(fd, F_CLOSEM) needs the minimum filedescriptor
+ * to close. the current code sets the last one to keep
+ * open. So increment it with 1 and use that as argument.
+ */
+ low_fd++;
+ fcntl(low_fd, F_CLOSEM);
+#elif defined(HAVE_CLOSEFROM)
/*
* closefrom needs the minimum filedescriptor to close.
* the current code sets the last one to keep open.