mirror of
https://github.com/haiwen/seafile.git
synced 2025-01-07 03:17:13 +08:00
Check if the system supports xattr (#2802)
* Check if the system supports xattr * Support xatttr for FreeBSD and NetBSD --------- Co-authored-by: heran yang <heran.yang@seafile.com>
This commit is contained in:
parent
ae515945c3
commit
c55e4d4021
19
lib/utils.c
19
lib/utils.c
@ -50,9 +50,16 @@
|
||||
|
||||
#ifndef WIN32
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/xattr.h>
|
||||
#endif
|
||||
|
||||
#if defined __FreeBSD__ || defined __NetBSD__
|
||||
#include <sys/extattr.h>
|
||||
#endif
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#include "log.h"
|
||||
@ -2724,6 +2731,12 @@ out:
|
||||
#ifdef __APPLE__
|
||||
return getxattr (path, name, value, size, 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined __FreeBSD__ || defined __NetBSD__
|
||||
return extattr_get_file (path, EXTATTR_NAMESPACE_USER, name, value, size);
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
@ -2772,6 +2785,12 @@ out:
|
||||
#ifdef __APPLE__
|
||||
return setxattr (path, name, value, size, 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined __FreeBSD__ || defined __NetBSD__
|
||||
return extattr_set_file (path, EXTATTR_NAMESPACE_USER, name, value, size);
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user