Hi, I'd like to propose this patch to allow to use xattr on FreeBSD.
Cheers ! -- François Charlier
>From c6e20f39df96d02f1c5c27ed2a8108ce5f4289c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charlier?= <[email protected]> Date: Tue, 1 Oct 2013 21:57:14 +0200 Subject: [PATCH] xattr: add support for FreeBSD xattr API --- src/tool_xattr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tool_xattr.c b/src/tool_xattr.c index 505bdb1..36ad7a9 100644 --- a/src/tool_xattr.c +++ b/src/tool_xattr.c @@ -23,13 +23,17 @@ #ifdef HAVE_FSETXATTR # include <sys/xattr.h> /* header from libc, not from libattr */ +#elif defined(__FreeBSD_version) && (__FreeBSD_version > 500000) +# include <sys/types.h> +# include <sys/extattr.h> #endif #include "tool_xattr.h" #include "memdebug.h" /* keep this as LAST include */ -#ifdef HAVE_FSETXATTR +#if defined(HAVE_FSETXATTR) || \ + (defined(__FreeBSD_version) && (__FreeBSD_version > 500000)) /* mapping table of curl metadata to extended attribute names */ static const struct xattr_mapping { @@ -60,6 +64,11 @@ int fwrite_xattr(CURL *curl, int fd) err = fsetxattr(fd, mappings[i].attr, value, strlen(value), 0, 0); #elif defined(HAVE_FSETXATTR_5) err = fsetxattr(fd, mappings[i].attr, value, strlen(value), 0); +#elif (defined(__FreeBSD_version) && (__FreeBSD_version > 500000)) + err = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, mappings[i].attr, value, + strlen(value)); + // FreeBSD's extattr_set_fd returns the length of the extended attribute + err = err < 0 ? err : 0; #endif } i++; -- 1.8.3.2
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
