summaryrefslogtreecommitdiffstats
path: root/src/fsade.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fsade.c')
-rw-r--r--src/fsade.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fsade.c b/src/fsade.c
index 11dcd9b..a5073ab 100644
--- a/src/fsade.c
+++ b/src/fsade.c
@@ -26,10 +26,12 @@
# include <selinux/selinux.h>
#endif
-#if BFS_USE_SYS_EXTATTR_H
+#if __has_include(<sys/extattr.h>)
# include <sys/extattr.h>
-#elif BFS_USE_SYS_XATTR_H
+# define BFS_USE_EXTATTR true
+#elif __has_include(<sys/xattr.h>)
# include <sys/xattr.h>
+# define BFS_USE_XATTR true
#endif
/**
@@ -344,7 +346,7 @@ int bfs_check_capabilities(const struct BFTW *ftwbuf) {
#if BFS_CAN_CHECK_XATTRS
-#if BFS_USE_SYS_EXTATTR_H
+#if BFS_USE_EXTATTR
/** Wrapper for extattr_list_{file,link}. */
static ssize_t bfs_extattr_list(const char *path, enum bfs_type type, int namespace) {
@@ -390,13 +392,13 @@ static ssize_t bfs_extattr_get(const char *path, enum bfs_type type, int namespa
#endif
}
-#endif // BFS_USE_SYS_EXTATTR_H
+#endif // BFS_USE_EXTATTR
int bfs_check_xattrs(const struct BFTW *ftwbuf) {
const char *path = fake_at(ftwbuf);
ssize_t len;
-#if BFS_USE_SYS_EXTATTR_H
+#if BFS_USE_EXTATTR
len = bfs_extattr_list(path, ftwbuf->type, EXTATTR_NAMESPACE_SYSTEM);
if (len <= 0) {
len = bfs_extattr_list(path, ftwbuf->type, EXTATTR_NAMESPACE_USER);
@@ -432,7 +434,7 @@ int bfs_check_xattr_named(const struct BFTW *ftwbuf, const char *name) {
const char *path = fake_at(ftwbuf);
ssize_t len;
-#if BFS_USE_SYS_EXTATTR_H
+#if BFS_USE_EXTATTR
len = bfs_extattr_get(path, ftwbuf->type, EXTATTR_NAMESPACE_SYSTEM, name);
if (len < 0) {
len = bfs_extattr_get(path, ftwbuf->type, EXTATTR_NAMESPACE_USER, name);