From 22623192bacd539306fa22fc2128f7cdf2146ae5 Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Thu, 2 Nov 2006 19:19:08 +0000 Subject: * configure.in: Add a check for DIR *dirp->dd_fd * dbus/dbus-sysdeps-util-unix: if HAVE_DDFD is defined use DIR *dirp->dd_fd else use DIR *dirp->__dd_fd. This takes care of both Solaris and Irix --- ChangeLog | 8 ++++++++ configure.in | 21 ++++++++++++++++++--- dbus/dbus-sysdeps-util-unix.c | 4 +++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 853880b5..206c2400 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-11-02 John (J5) Palmieri + + * configure.in: Add a check for DIR *dirp->dd_fd + + * dbus/dbus-sysdeps-util-unix: if HAVE_DDFD is defined use + DIR *dirp->dd_fd else use DIR *dirp->__dd_fd. This takes care + of both Solaris and Irix + 2006-11-01 Havoc Pennington * bus/dbus-daemon.1.in: document standard_session_servicedirs diff --git a/configure.in b/configure.in index b4759b47..51a7fa85 100644 --- a/configure.in +++ b/configure.in @@ -526,10 +526,8 @@ AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist fpathconf) - - AC_MSG_CHECKING(for dirfd) -AC_TRY_COMPILE([ +AC_TRY_LINK([ #include #include ],[ @@ -542,6 +540,23 @@ dbus_have_dirfd=yes, dbus_have_dirfd=no) AC_MSG_RESULT($dbus_have_dirfd) if test "$dbus_have_dirfd" = yes; then AC_DEFINE(HAVE_DIRFD,1,[Have dirfd function]) +else + AC_MSG_CHECKING(for DIR *dirp->dd_fd) + AC_TRY_LINK([ +#include +#include + ],[ +DIR *dirp; +int fd; +dirp = opendir("."); +fd = dirp->dd_fd; +closedir(dirp); + ], + dbus_have_ddfd=yes, dbus_have_ddfd=no) + AC_MSG_RESULT($dbus_have_ddfd) + if test "$dbus_have_ddfd" = yes; then + AC_DEFINE(HAVE_DDFD,1,[Have the ddfd member of DIR]) + fi fi AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)]) diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 57c943d2..f57b7807 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -510,8 +510,10 @@ dirent_buf_size(DIR * dirp, size_t *size) # if defined(HAVE_FPATHCONF) && defined(_PC_NAME_MAX) # if defined(HAVE_DIRFD) name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX); -# else +# elif defined(HAVE_DDFD) name_max = fpathconf(dirp->dd_fd, _PC_NAME_MAX); +# else + name_max = fpathconf(dirp->__dd_fd, _PC_NAME_MAX); # endif /* HAVE_DIRFD */ if (name_max == -1) # if defined(NAME_MAX) -- cgit