From 1fa70fcd4d876174f8ad4dbb9279218ea7bacf0e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 1 Dec 2008 07:47:28 +0000 Subject: [PATCH] Apply Marco's Darwin xattr patches git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8099 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/filed/acl.c | 19 +++++-------------- bacula/src/filed/xattr.c | 37 +++++++++++++++++++++++-------------- bacula/src/version.h | 6 +++--- bacula/technotes-2.5 | 2 ++ 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/bacula/src/filed/acl.c b/bacula/src/filed/acl.c index 3e4d7c9776..bb1130b426 100644 --- a/bacula/src/filed/acl.c +++ b/bacula/src/filed/acl.c @@ -246,20 +246,11 @@ static acl_type_t bac_to_os_acltype(bacl_type acltype) return ostype; } +#if !defined(HAVE_DARWIN_OS) /* * See if an acl is a trivial one (e.g. just the stat bits encoded as acl.) * There is no need to store those acls as we already store the stat bits too. */ -#if defined(HAVE_DARWIN_OS) -static bool acl_is_trivial(acl_t acl) -{ - /* - * acl is trivial if it is empty. - */ -// return (acl_entries(acl) == 0); - return true; /* Allow to compile -- KES */ -} -#else /* FreeBSD, IRIX, OSF1, Linux */ static bool acl_is_trivial(acl_t acl) { /* @@ -377,12 +368,11 @@ static int generic_get_acl_from_os(JCR *jcr, bacl_type acltype) } #endif +#if !defined(HAVE_DARWIN_OS) /* * Make sure this is not just a trivial ACL. */ - if ((acltype == BACL_TYPE_ACCESS || - acltype == BACL_TYPE_EXTENDED) && - acl_is_trivial(acl)) { + if (acltype == BACL_TYPE_ACCESS && acl_is_trivial(acl)) { /* * The ACLs simply reflect the (already known) standard permissions * So we don't send an ACL stream to the SD. @@ -391,6 +381,7 @@ static int generic_get_acl_from_os(JCR *jcr, bacl_type acltype) acl_free(acl); return 0; } +#endif if ((acl_text = acl_to_text(acl, NULL)) != NULL) { len = pm_strcpy(jcr->acl_data, acl_text); @@ -534,12 +525,12 @@ static bool darwin_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt) */ if ((len = generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS)) < 0) return false; -#endif if (len > 0) { if (!send_acl_stream(jcr, STREAM_ACL_DARWIN_ACCESS_ACL_T, len)) return false; } +#endif return true; } diff --git a/bacula/src/filed/xattr.c b/bacula/src/filed/xattr.c index 89ba84ceca..ac15235377 100644 --- a/bacula/src/filed/xattr.c +++ b/bacula/src/filed/xattr.c @@ -46,12 +46,6 @@ #include "filed.h" #include "xattr.h" -/* Klude to fix Darwin build -- KES */ -#ifdef HAVE_DARWIN_OS -#undef HAVE_XATTR -#endif - - /* * List of supported OSs. */ @@ -80,14 +74,29 @@ bool parse_xattr_stream(JCR *jcr, int stream) #include #endif -#if defined(HAVE_GETXATTR) && !defined(HAVE_LGETXATTR) -#define lgetxattr getxattr -#endif -#if defined(HAVE_SETXATTR) && !defined(HAVE_LSETXATTR) -#define lsetxattr setxattr -#endif -#if defined(HAVE_LISTXATTR) && !defined(HAVE_LLISTXATTR) -#define llistxattr listxattr +/* + * OSX doesn't have llistxattr, lgetxattr and lsetxattr but has + * listxattr, getxattr and setxattr with an extra options argument + * which mimics the l variants of the functions when we specify + * XATTR_NOFOLLOW as the options value. + */ +#if defined(HAVE_DARWIN_OS) + #define llistxattr(path, list, size) listxattr((path), (list), (size), XATTR_NOFOLLOW) + #define lgetxattr(path, name, value, size) getxattr((path), (name), (value), (size), XATTR_NOFOLLOW) + #define lsetxattr(path, name, value, size, flags) setxattr((path), (name), (value), (size), (flags), XATTR_NOFOLLOW) +#else + /* + * Fallback to the non l-functions when those are not available. + */ + #if defined(HAVE_GETXATTR) && !defined(HAVE_LGETXATTR) + #define lgetxattr getxattr + #endif + #if defined(HAVE_SETXATTR) && !defined(HAVE_LSETXATTR) + #define lsetxattr setxattr + #endif + #if defined(HAVE_LISTXATTR) && !defined(HAVE_LLISTXATTR) + #define llistxattr listxattr + #endif #endif /* diff --git a/bacula/src/version.h b/bacula/src/version.h index 194530f2b6..562333e73e 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.5.21" -#define BDATE "26 November 2008" -#define LSMDATE "26Nov08" +#define VERSION "2.5.22" +#define BDATE "01 December 2008" +#define LSMDATE "01Dec08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 762baf1fda..9b4c7ee4e6 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -10,6 +10,8 @@ filepattern (restore with regex in bsr) mixed priorities General: +01Dec08 +kes Apply Marco's Darwin xattr patches. 28Nov08 kes Fix Win32 build. 26Nov08 -- 2.39.5