]> granicus.if.org Git - sudo/commitdiff
Add a check for a dirfd() function (like Linux) and add a dirfd
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jun 2004 19:13:37 +0000 (19:13 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jun 2004 19:13:37 +0000 (19:13 +0000)
macro in compat.h if there is no dirfd() function or macro.

compat.h
config.h.in
configure
configure.in

index f6fb926e647cb0372f19be658d950af4044b89aa..2d87cffc7a25d3168e4d036304a267056116a09b 100644 (file)
--- a/compat.h
+++ b/compat.h
@@ -203,6 +203,13 @@ typedef struct sigaction sigaction_t;
 # 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.
index 80778bd20eae9062c7b012c24aa76ed58f0436ab..7e61baab3541cb4b1c29b68dbc3ade8b3dcaac1a 100644 (file)
@@ -75,6 +75,9 @@
    */
 #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
 
index 4dcec314273295eb99454c0ac7cc2b8b9d059d69..20c6b8ff7bebf205a6144ff26e3c9d9cc096606d 100755 (executable)
--- a/configure
+++ b/configure
@@ -26147,7 +26147,8 @@ _ACEOF
 
 
 
-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
index 234d7a31f3e43ce9f3b30ac898c602ba88417fc1..72b95ec6b9e8cc621414849fa1fa1b0da43e8675 100644 (file)
@@ -1705,7 +1705,7 @@ AC_CHECK_FUNCS(lsearch, , [AC_CHECK_LIB(compat, lsearch, AC_CHECK_HEADER(search.
 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