OS X has fsetxattr() in another header and with different arguments.
For now, check for the Linux variant and if not available, skip
the code using the call.
Signed-off-by: Jan Tulak <jtulak@xxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
---
configure.ac | 1 +
fsr/xfs_fsr.c | 2 ++
include/builddefs.in | 4 ++++
m4/package_libcdev.m4 | 13 +++++++++++++
4 files changed, 20 insertions(+)
diff --git a/configure.ac b/configure.ac
index aa241cd..5d8486e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,6 +123,7 @@ AC_HAVE_SYNC_FILE_RANGE
AC_HAVE_MNTENT
AC_HAVE_FLS
AC_HAVE_READDIR
+AC_HAVE_FSETXATTR
if test "$enable_blkid" = yes; then
AC_HAVE_BLKID_TOPO
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index b673761..e1b7bd6 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -1025,6 +1025,7 @@ fsr_setup_attr_fork(
int tfd,
xfs_bstat_t *bstatp)
{
+#ifdef HAVE_FSETXATTR
struct stat64 tstatbuf;
int i;
int diff = 0;
@@ -1199,6 +1200,7 @@ out:
if (dflag && diff)
fsrprintf(_("failed to match fork offset\n"));;
+#endif /* HAVE_FSETXATTR */
return 0;
}
diff --git a/include/builddefs.in b/include/builddefs.in
index 6c16a65..25b8816 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -106,6 +106,7 @@ HAVE_SYNC_FILE_RANGE = @have_sync_file_range@
HAVE_READDIR = @have_readdir@
HAVE_MNTENT = @have_mntent@
HAVE_FLS = @have_fls@
+HAVE_FSETXATTR = @have_fsetxattr@
GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
# -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
@@ -139,6 +140,9 @@ endif
ifeq ($(HAVE_MNTENT),yes)
PCFLAGS+= -DHAVE_MNTENT
endif
+ifeq ($(HAVE_FSETXATTR),yes)
+PCFLAGS+= -DHAVE_FSETXATTR
+endif
ifeq ($(ENABLE_BLKID),yes)
PCFLAGS+= -DENABLE_BLKID
endif
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 4a96374..5e900ab 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -215,6 +215,19 @@ AC_DEFUN([AC_HAVE_FLS],
])
#
+# Check if we have a fsetxattr call (Mac OS X)
+#
+AC_DEFUN([AC_HAVE_FSETXATTR],
+ [ AC_CHECK_DECL([fsetxattr],
+ have_fsetxattr=yes,
+ [],
+ [#include <sys/types.h>
+ #include <attr/xattr.h>]
+ )
+ AC_SUBST(have_fsetxattr)
+ ])
+
+#
# Check if there is mntent.h
#
AC_DEFUN([AC_HAVE_MNTENT],
--
2.4.3
|