mirror of
https://github.com/vgough/encfs.git
synced 2025-08-16 08:47:54 +02:00
Make all xattr operations on link themselves
This commit is contained in:
@ -93,20 +93,6 @@ check_cxx_source_compiles ("#include <sys/types.h>
|
|||||||
int main() { getxattr(0,0,0,0,0,0); return 1; }
|
int main() { getxattr(0,0,0,0,0,0); return 1; }
|
||||||
" XATTR_ADD_OPT)
|
" XATTR_ADD_OPT)
|
||||||
|
|
||||||
# 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.
|
# Check if we have some standard functions.
|
||||||
include (CheckFuncs)
|
include (CheckFuncs)
|
||||||
check_function_exists_glibc (lchmod HAVE_LCHMOD)
|
check_function_exists_glibc (lchmod HAVE_LCHMOD)
|
||||||
|
@ -660,7 +660,7 @@ int encfs_statfs(const char *path, struct statvfs *st) {
|
|||||||
#ifdef XATTR_ADD_OPT
|
#ifdef XATTR_ADD_OPT
|
||||||
int _do_setxattr(EncFS_Context *, const string &cyName, const char *name,
|
int _do_setxattr(EncFS_Context *, const string &cyName, const char *name,
|
||||||
const char *value, size_t size, uint32_t pos) {
|
const char *value, size_t size, uint32_t pos) {
|
||||||
int options = 0;
|
int options = XATTR_NOFOLLOW;
|
||||||
return ::setxattr(cyName.c_str(), name, value, size, pos, options);
|
return ::setxattr(cyName.c_str(), name, value, size, pos, options);
|
||||||
}
|
}
|
||||||
int encfs_setxattr(const char *path, const char *name, const char *value,
|
int encfs_setxattr(const char *path, const char *name, const char *value,
|
||||||
@ -673,7 +673,7 @@ int encfs_setxattr(const char *path, const char *name, const char *value,
|
|||||||
#else
|
#else
|
||||||
int _do_setxattr(EncFS_Context *, const string &cyName, const char *name,
|
int _do_setxattr(EncFS_Context *, const string &cyName, const char *name,
|
||||||
const char *value, size_t size, int flags) {
|
const char *value, size_t size, int flags) {
|
||||||
return ::setxattr(cyName.c_str(), name, value, size, flags);
|
return ::lsetxattr(cyName.c_str(), name, value, size, flags);
|
||||||
}
|
}
|
||||||
int encfs_setxattr(const char *path, const char *name, const char *value,
|
int encfs_setxattr(const char *path, const char *name, const char *value,
|
||||||
size_t size, int flags) {
|
size_t size, int flags) {
|
||||||
@ -686,7 +686,7 @@ int encfs_setxattr(const char *path, const char *name, const char *value,
|
|||||||
#ifdef XATTR_ADD_OPT
|
#ifdef XATTR_ADD_OPT
|
||||||
int _do_getxattr(EncFS_Context *, const string &cyName, const char *name,
|
int _do_getxattr(EncFS_Context *, const string &cyName, const char *name,
|
||||||
void *value, size_t size, uint32_t pos) {
|
void *value, size_t size, uint32_t pos) {
|
||||||
int options = 0;
|
int options = XATTR_NOFOLLOW;
|
||||||
return ::getxattr(cyName.c_str(), name, value, size, pos, options);
|
return ::getxattr(cyName.c_str(), name, value, size, pos, options);
|
||||||
}
|
}
|
||||||
int encfs_getxattr(const char *path, const char *name, char *value, size_t size,
|
int encfs_getxattr(const char *path, const char *name, char *value, size_t size,
|
||||||
@ -698,7 +698,7 @@ int encfs_getxattr(const char *path, const char *name, char *value, size_t size,
|
|||||||
#else
|
#else
|
||||||
int _do_getxattr(EncFS_Context *, const string &cyName, const char *name,
|
int _do_getxattr(EncFS_Context *, const string &cyName, const char *name,
|
||||||
void *value, size_t size) {
|
void *value, size_t size) {
|
||||||
return ::getxattr(cyName.c_str(), name, value, size);
|
return ::lgetxattr(cyName.c_str(), name, value, size);
|
||||||
}
|
}
|
||||||
int encfs_getxattr(const char *path, const char *name, char *value,
|
int encfs_getxattr(const char *path, const char *name, char *value,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
@ -710,12 +710,9 @@ int encfs_getxattr(const char *path, const char *name, char *value,
|
|||||||
|
|
||||||
int _do_listxattr(EncFS_Context *, const string &cyName, char *list,
|
int _do_listxattr(EncFS_Context *, const string &cyName, char *list,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
#ifndef XATTR_LLIST
|
|
||||||
#define llistxattr listxattr
|
|
||||||
#endif
|
|
||||||
#ifdef XATTR_ADD_OPT
|
#ifdef XATTR_ADD_OPT
|
||||||
int options = 0;
|
int options = XATTR_NOFOLLOW;
|
||||||
int res = ::llistxattr(cyName.c_str(), list, size, options);
|
int res = ::listxattr(cyName.c_str(), list, size, options);
|
||||||
#else
|
#else
|
||||||
int res = ::llistxattr(cyName.c_str(), list, size);
|
int res = ::llistxattr(cyName.c_str(), list, size);
|
||||||
#endif
|
#endif
|
||||||
@ -729,10 +726,10 @@ int encfs_listxattr(const char *path, char *list, size_t size) {
|
|||||||
|
|
||||||
int _do_removexattr(EncFS_Context *, const string &cyName, const char *name) {
|
int _do_removexattr(EncFS_Context *, const string &cyName, const char *name) {
|
||||||
#ifdef XATTR_ADD_OPT
|
#ifdef XATTR_ADD_OPT
|
||||||
int options = 0;
|
int options = XATTR_NOFOLLOW;
|
||||||
int res = ::removexattr(cyName.c_str(), name, options);
|
int res = ::removexattr(cyName.c_str(), name, options);
|
||||||
#else
|
#else
|
||||||
int res = ::removexattr(cyName.c_str(), name);
|
int res = ::lremovexattr(cyName.c_str(), name);
|
||||||
#endif
|
#endif
|
||||||
return (res == -1) ? -errno : res;
|
return (res == -1) ? -errno : res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user