[Box Backup-commit] COMMIT r2054 - in box/trunk: . lib/common

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Tue, 22 Jan 2008 01:00:12 +0000 (UTC)


Author: chris
Date: 2008-01-22 01:00:12 +0000 (Tue, 22 Jan 2008)
New Revision: 2054

Modified:
   box/trunk/configure.ac
   box/trunk/lib/common/BoxPlatform.h
Log:
Detect whether struct DIR has d_fd or dd_fd member and define the
dirfd() macro accordingly.


Modified: box/trunk/configure.ac
===================================================================
--- box/trunk/configure.ac	2008-01-22 00:59:22 UTC (rev 2053)
+++ box/trunk/configure.ac	2008-01-22 01:00:12 UTC (rev 2054)
@@ -159,6 +159,8 @@
   #include <sys/types.h>
   #include <netinet/in.h>
   ]])
+AC_CHECK_MEMBERS([DIR.d_fd],,,  [[#include <dirent.h>]])
+AC_CHECK_MEMBERS([DIR.dd_fd],,, [[#include <dirent.h>]])
 
 AC_CHECK_DECLS([INFTIM],,, [[#include <poll.h>]])
 AC_CHECK_DECLS([SO_PEERCRED],,, [[#include <sys/socket.h>]])

Modified: box/trunk/lib/common/BoxPlatform.h
===================================================================
--- box/trunk/lib/common/BoxPlatform.h	2008-01-22 00:59:22 UTC (rev 2053)
+++ box/trunk/lib/common/BoxPlatform.h	2008-01-22 01:00:12 UTC (rev 2054)
@@ -170,7 +170,13 @@
 // so do it here instead of in configure.ac.
 
 #if ! HAVE_DECL_DIRFD
-	#define dirfd(x) (x)->d_fd
+	#ifdef HAVE_DIR_D_FD
+		#define dirfd(x) (x)->d_fd
+	#elif defined HAVE_DIR_DD_FD
+		#define dirfd(x) (x)->dd_fd
+	#else
+		#error No way to get file descriptor from DIR structure
+	#endif
 #endif
 
 #endif // BOXPLATFORM__H