mirror of
https://github.com/vgough/encfs.git
synced 2024-11-21 23:43:26 +01:00
Check that llistxattr exists (#307)
This PR solves https://github.com/vgough/encfs/issues/305 "llistxattr breaks compilation on Mac OS X" checking whether llistxattr exists or not.
This commit is contained in:
parent
7cc6efa60c
commit
7295b3369b
@ -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 <sys/types.h>
|
||||
#include <sys/xattr.h>
|
||||
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 <sys/types.h>
|
||||
#include <sys/xattr.h>
|
||||
int main() { llistxattr(0,0,0,0); return 1; }
|
||||
" XATTR_LLIST)
|
||||
else (XATTR_ADD_OPT)
|
||||
check_cxx_source_compiles ("#include <sys/types.h>
|
||||
#include <sys/xattr.h>
|
||||
int main() { llistxattr(0,0,0); return 1; }
|
||||
" XATTR_LLIST)
|
||||
endif (XATTR_ADD_OPT)
|
||||
|
||||
# Check if we have some standard functions.
|
||||
include (CheckFuncs)
|
||||
|
@ -3,6 +3,7 @@
|
||||
#cmakedefine HAVE_ATTR_XATTR_H
|
||||
#cmakedefine HAVE_SYS_XATTR_H
|
||||
#cmakedefine XATTR_ADD_OPT
|
||||
#cmakedefine XATTR_LLIST
|
||||
|
||||
#cmakedefine HAVE_LCHMOD
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user