mirror of
https://github.com/vgough/encfs.git
synced 2025-03-31 19:36:08 +02:00
check for additional arguments to xattr functions
git-svn-id: http://encfs.googlecode.com/svn/trunk@12 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
parent
e8e2a6a610
commit
931dcdd2af
22
configure.ac
22
configure.ac
@ -92,6 +92,28 @@ dnl fuse_operations.setxattr was added 2004-03-31
|
||||
dnl only enable it if setxattr function is found..
|
||||
AC_CHECK_HEADERS([attr/xattr.h sys/xattr.h])
|
||||
|
||||
# Do xattr functions take additional options like on Darwin?
|
||||
AC_CACHE_CHECK([whether xattr interface takes additional options],
|
||||
smb_attr_cv_xattr_add_opt, [
|
||||
old_LIBS=$LIBS
|
||||
LIBS="$LIBS $ACL_LIBS"
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#if HAVE_ATTR_XATTR_H
|
||||
#include <attr/xattr.h>
|
||||
#elif HAVE_SYS_XATTR_H
|
||||
#include <sys/xattr.h>
|
||||
#endif
|
||||
],[
|
||||
getxattr(0, 0, 0, 0, 0, 0);
|
||||
],
|
||||
[smb_attr_cv_xattr_add_opt=yes],
|
||||
[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
|
||||
])
|
||||
if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
|
||||
AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
|
||||
fi
|
||||
|
||||
dnl Check for valgrind headers..
|
||||
AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h])
|
||||
|
||||
|
@ -698,8 +698,15 @@ int encfs_statfs(const char *path, struct statvfs *st)
|
||||
int _do_setxattr(EncFS_Context *, const string &cyName,
|
||||
tuple<const char *, const char *, size_t, int> data)
|
||||
{
|
||||
#ifdef XATTR_ADD_OPT
|
||||
int options = 0;
|
||||
// flags argument is ignored..
|
||||
int res = ::setxattr( cyName.c_str(), data.get<0>(), data.get<1>(),
|
||||
data.get<2>(), 0, options );
|
||||
#else
|
||||
int res = ::setxattr( cyName.c_str(), data.get<0>(), data.get<1>(),
|
||||
data.get<2>(), data.get<3>() );
|
||||
#endif
|
||||
return (res == -1) ? -errno : res;
|
||||
}
|
||||
|
||||
@ -713,8 +720,14 @@ int encfs_setxattr( const char *path, const char *name,
|
||||
int _do_getxattr(EncFS_Context *, const string &cyName,
|
||||
tuple<const char *, void *, size_t> data)
|
||||
{
|
||||
#ifdef XATTR_ADD_OPT
|
||||
int options = 0;
|
||||
int res = ::getxattr( cyName.c_str(), data.get<0>(),
|
||||
data.get<1>(), data.get<2>(), 0, options);
|
||||
#else
|
||||
int res = ::getxattr( cyName.c_str(), data.get<0>(),
|
||||
data.get<1>(), data.get<2>());
|
||||
#endif
|
||||
return (res == -1) ? -errno : res;
|
||||
}
|
||||
|
||||
@ -728,7 +741,13 @@ int encfs_getxattr( const char *path, const char *name,
|
||||
int _do_listxattr(EncFS_Context *, const string &cyName,
|
||||
tuple<char *, size_t> data)
|
||||
{
|
||||
#ifdef XATTR_ADD_OPT
|
||||
int options = 0;
|
||||
int res = ::listxattr( cyName.c_str(), data.get<0>(), data.get<1>(),
|
||||
options );
|
||||
#else
|
||||
int res = ::listxattr( cyName.c_str(), data.get<0>(), data.get<1>() );
|
||||
#endif
|
||||
return (res == -1) ? -errno : res;
|
||||
}
|
||||
|
||||
@ -740,7 +759,12 @@ int encfs_listxattr( const char *path, char *list, size_t size )
|
||||
|
||||
int _do_removexattr(EncFS_Context *, const string &cyName, const char *name)
|
||||
{
|
||||
#ifdef XATTR_ADD_OPT
|
||||
int options = 0;
|
||||
int res = ::removexattr( cyName.c_str(), name, options );
|
||||
#else
|
||||
int res = ::removexattr( cyName.c_str(), name );
|
||||
#endif
|
||||
return (res == -1) ? -errno : res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user