diff --git a/CMakeLists.txt b/CMakeLists.txt index 4376c5a..1aa6554 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,15 +83,25 @@ check_include_file_cxx (attr/xattr.h HAVE_ATTR_XATTR_H) check_include_file_cxx (sys/xattr.h HAVE_SYS_XATTR_H) # Check if xattr functions take extra arguments, as they do on OSX. -# Output error is misleading, so do this test quietly. include (CheckCXXSourceCompiles) -set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) -set (CMAKE_REQUIRED_QUIET True) check_cxx_source_compiles ("#include #include int main() { getxattr(0,0,0,0,0,0); return 1; } " XATTR_ADD_OPT) -set (CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) + +# Check if xattr function llistxattr exists. +include (CheckCXXSourceCompiles) +if (XATTR_ADD_OPT) +check_cxx_source_compiles ("#include + #include + int main() { llistxattr(0,0,0,0); return 1; } + " XATTR_LLIST) +else (XATTR_ADD_OPT) +check_cxx_source_compiles ("#include + #include + int main() { llistxattr(0,0,0); return 1; } + " XATTR_LLIST) +endif (XATTR_ADD_OPT) # Check if we have some standard functions. include (CheckFuncs) diff --git a/config.h.cmake b/config.h.cmake index 2beb78d..1e2fdc4 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -3,6 +3,7 @@ #cmakedefine HAVE_ATTR_XATTR_H #cmakedefine HAVE_SYS_XATTR_H #cmakedefine XATTR_ADD_OPT +#cmakedefine XATTR_LLIST #cmakedefine HAVE_LCHMOD diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp index d9d0f1a..3ff7355 100644 --- a/encfs/encfs.cpp +++ b/encfs/encfs.cpp @@ -710,6 +710,9 @@ int encfs_getxattr(const char *path, const char *name, char *value, int _do_listxattr(EncFS_Context *, const string &cyName, char *list, size_t size) { +#ifndef XATTR_LLIST +#define llistxattr listxattr +#endif #ifdef XATTR_ADD_OPT int options = 0; int res = ::llistxattr(cyName.c_str(), list, size, options);