From 39c5a5e929efc7c3b89a4e316dfd02b1734848d6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Pawelczyk Date: Mon, 19 Feb 2018 00:34:14 +0100 Subject: Support building with no extended attributes support. Support building with no extended attributes support when NO_XATTR macro is predefined to non-0 value (e.g. put -DNO_XATTR in CFLAGS). --- src/metaentry.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/metaentry.c') diff --git a/src/metaentry.c b/src/metaentry.c index 65992f5..6c5bc84 100644 --- a/src/metaentry.c +++ b/src/metaentry.c @@ -25,7 +25,11 @@ #include #include #include -#include + +#if !defined(NO_XATTR) || !NO_XATTR +# include +#endif /* !NO_XATTR */ + #include #include #include @@ -48,6 +52,7 @@ # define PATH_MAX 4096 #endif +#if !defined(NO_XATTR) || !NO_XATTR /* Free's a metaentry and all its parameters */ static void mentry_free(struct metaentry *m) @@ -72,6 +77,7 @@ mentry_free(struct metaentry *m) free(m); } +#endif /* !NO_XATTR */ /* Allocates an empty metahash table */ static struct metahash * @@ -189,12 +195,16 @@ mentries_print(const struct metahash *mhash) struct metaentry * mentry_create(const char *path) { +#if !defined(NO_XATTR) || !NO_XATTR ssize_t lsize, vsize; char *list, *attr; +#endif /* !NO_XATTR */ struct stat sbuf; struct passwd *pbuf; struct group *gbuf; +#if !defined(NO_XATTR) || !NO_XATTR int i; +#endif /* !NO_XATTR */ struct metaentry *mentry; if (lstat(path, &sbuf)) { @@ -230,6 +240,7 @@ mentry_create(const char *path) if (S_ISLNK(mentry->mode)) return mentry; +#if !defined(NO_XATTR) || !NO_XATTR lsize = listxattr(path, NULL, 0); if (lsize < 0) { /* Perhaps the FS doesn't support xattrs? */ @@ -299,6 +310,8 @@ mentry_create(const char *path) } free(list); +#endif /* !NO_XATTR */ + return mentry; } -- cgit v1.2.1