diff --git a/libisofs/aaip-os-freebsd.c b/libisofs/aaip-os-freebsd.c index 842613b..48caa97 100644 --- a/libisofs/aaip-os-freebsd.c +++ b/libisofs/aaip-os-freebsd.c @@ -5,9 +5,9 @@ Arbitrary Attribute Interchange Protocol , system adapter for getting and setting of ACLs and xattr. - To be included by aaip_0_2.c + To be included by aaip_0_2.c for FreeBSD and NetBSD - Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+ + Copyright (c) 2009 - 2014 Thomas Schmitt, libburnia project, GPLv2+ */ @@ -32,6 +32,8 @@ #include #endif +#include + /* <<< Use old ACL adapter code that is unable to deal with extattr */ /* # define Libisofs_old_freebsd_acl_adapteR */ @@ -70,6 +72,32 @@ int aaip_local_attr_support(int flag) } +#ifdef Libisofs_with_freebsd_extattR + +static int aaip_extattr_path_supp(char *path, int flag) +{ + +#ifdef MNT_EXTATTR + + int ret; + struct statvfs statvfs_buf; + + ret = statvfs(path, &statvfs_buf); + if(ret == -1) + return(1); + return(!!(statvfs_buf.f_flag & MNT_EXTATTR)); + +#else /* MNT_EXTATTR */ + + return(1); + +#endif /* ! MNT_EXTATTR */ + +} + +#endif /* Libisofs_with_freebsd_extattR */ + + /* ------------------------------ Getters --------------------------------- */ /* Obtain the ACL of the given file in long text form. @@ -195,8 +223,13 @@ static int aaip_extattr_make_list(char *path, int attrnamespace, *list_size= extattr_list_file(path, attrnamespace, NULL, (size_t) 0); else *list_size= extattr_list_link(path, attrnamespace, NULL, (size_t) 0); - if(*list_size == -1) + if(*list_size == -1) { + if(! aaip_extattr_path_supp(path, 0)) { + *list_size = 0; + return(2); + } return(0); + } if(*list_size == 0) return(2); *list= calloc(*list_size, 1); diff --git a/libisofs/aaip-os-linux.c b/libisofs/aaip-os-linux.c index a01b2ca..8880f64 100644 --- a/libisofs/aaip-os-linux.c +++ b/libisofs/aaip-os-linux.c @@ -5,7 +5,7 @@ Arbitrary Attribute Interchange Protocol , system adapter for getting and setting of ACLs and xattr. - To be included by aaip_0_2.c + To be included by aaip_0_2.c for Linux Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+ diff --git a/libisofs/aaip_0_2.c b/libisofs/aaip_0_2.c index 8ab93f8..9a842c0 100644 --- a/libisofs/aaip_0_2.c +++ b/libisofs/aaip_0_2.c @@ -7,7 +7,7 @@ See libisofs/aaip_0_2.h http://libburnia-project.org/wiki/AAIP - Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+ + Copyright (c) 2009 - 2014 Thomas Schmitt, libburnia project, GPLv2+ */ @@ -2181,6 +2181,11 @@ ex:; #include "aaip-os-freebsd.c" +#else +#ifdef __NetBSD__ + +#include "aaip-os-freebsd.c" + #else #ifdef __linux @@ -2198,5 +2203,6 @@ ex:; #include "aaip-os-dummy.c" #endif /* ! __linux */ +#endif /* ! __NetBSD__ */ #endif /* ! __FreeBSD__ */