From: Theodore Ts'o Date: Wed, 4 Jun 2025 20:29:49 +0000 (+0000) Subject: misc: define XATTR_{CREATE,REMOVE} if necessary X-Git-Tag: v1.47.3-rc2~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9882047bee29ded1c5c642a63166973cab29fb04;p=thirdparty%2Fe2fsprogs.git misc: define XATTR_{CREATE,REMOVE} if necessary This fixes a FreeBSD portability issue in fuse2fs. Fixes: 5c7fec6121e6 ("fuse2fs: support XATTR_CREATE/REPLACE in setxattr") Signed-off-by: Theodore Ts'o --- diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 19d43af3..ad4795ae 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -90,6 +90,20 @@ #define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1) #endif +/* + * Linux and MacOS implement the setxattr(2) interface, which defines + * XATTR_CREATE and XATTR_REPLACE. However, FreeBSD uses + * extattr_set_file(2), which does not have a flags or options + * parameter, and does not define XATTR_CREATE and XATTR_REPLACE. + */ +#ifndef XATTR_CREATE +#define XATTR_CREATE 0 +#endif + +#ifndef XATTR_REPLACE +#define XATTR_REPLACE 0 +#endif + #if !defined(EUCLEAN) #if !defined(EBADMSG) #define EUCLEAN EBADMSG