macro in compat.h if there is no dirfd() function or macro.
# endif
#endif
+/*
+ * If dirfd() does not exists, hopefully dd_fd does.
+ */
+#if !defined(HAVE_DIRFD) && !defined(dirfd)
+# define dirfd(_d) ((_d)->dd_fd)
+#endif
+
/*
* If we lack getprogname(), emulate with __progname if possible.
* Otherwise, add a prototype for use with our own getprogname.c.
*/
#undef HAVE_DIRENT_H
+/* Define to 1 if you have the `dirfd' function (not macro). */
+#undef HAVE_DIRFD
+
/* Define to 1 if you have the `dispcrypt' function. */
#undef HAVE_DISPCRYPT
-for ac_func in strerror strcasecmp sigaction strlcpy strlcat closefrom
+
+for ac_func in strerror strcasecmp sigaction strlcpy strlcat closefrom dirfd
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
AC_CHECK_FUNCS(utime, [SUDO_FUNC_UTIME_POSIX], [AC_LIBOBJ(utime)])
SUDO_FUNC_FNMATCH(AC_DEFINE(HAVE_FNMATCH, 1, [Define if you have the `fnmatch' function.]), AC_LIBOBJ(fnmatch))
SUDO_FUNC_ISBLANK
-AC_REPLACE_FUNCS(strerror strcasecmp sigaction strlcpy strlcat closefrom)
+AC_REPLACE_FUNCS(strerror strcasecmp sigaction strlcpy strlcat closefrom dirfd)
AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf, , [NEED_SNPRINTF=1])
dnl
dnl If NEED_SNPRINTF is set, add snprintf.c to LIBOBJS