From: "Erich E. Hoover" erich.e.hoover@gmail.com
--- configure.ac | 3 +++ dlls/ntdll/unix/file.c | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac index 8b372f39dfa..d7803b875f2 100644 --- a/configure.ac +++ b/configure.ac @@ -639,6 +639,9 @@ AC_CHECK_HEADERS([libprocstat.h],,, if test "x$with_xattr" != "xno" then AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1]) + AC_CHECK_HEADERS(sys/xattr.h, [HAVE_XATTR=1] + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]], [[getxattr("", "", "", 0, 0, 0);]])], + [AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr functions take additional arguments (Mac OS X)])])]) fi if test "x$with_xattr" = "xyes" then diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 094c5eb5ab5..1090b5fd563 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -99,7 +99,10 @@ #include <sys/statfs.h> #endif #ifdef HAVE_ATTR_XATTR_H +#undef XATTR_ADDITIONAL_OPTIONS #include <attr/xattr.h> +#elif defined(HAVE_SYS_XATTR_H) +#include <sys/xattr.h> #endif #include <time.h> #include <unistd.h> @@ -364,7 +367,9 @@ NTSTATUS errno_to_status( int err )
static int xattr_fremove( int filedes, const char *name ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return fremovexattr( filedes, name, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return fremovexattr( filedes, name ); #else errno = ENOSYS; @@ -374,7 +379,9 @@ static int xattr_fremove( int filedes, const char *name )
static int xattr_fset( int filedes, const char *name, void *value, size_t size ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return fsetxattr( filedes, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return fsetxattr( filedes, name, value, size, 0 ); #else errno = ENOSYS; @@ -384,7 +391,9 @@ static int xattr_fset( int filedes, const char *name, void *value, size_t size )
static int xattr_get( const char *path, const char *name, void *value, size_t size ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return getxattr( path, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return getxattr( path, name, value, size ); #else errno = ENOSYS; @@ -394,7 +403,9 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
static int xattr_remove( const char *path, const char *name ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return removexattr( path, name, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return removexattr( path, name ); #else errno = ENOSYS; @@ -404,7 +415,9 @@ static int xattr_remove( const char *path, const char *name )
static int xattr_set( const char *path, const char *name, void *value, size_t size ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return setxattr( path, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return setxattr( path, name, value, size, 0 ); #else errno = ENOSYS;