mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kio: use acl_get_file() to determine if filesystem supports ACL
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
db6e2344a3
commit
c3f8cfe6d2
3 changed files with 13 additions and 20 deletions
|
@ -21,7 +21,7 @@ build_script:
|
|||
sudo apt-get install -qq cmake katie-dev libenchant-dev \
|
||||
libmagick++-dev libmpv-dev xorg-dev mesa-common-dev \
|
||||
libavahi-common-dev krb5-multidev libwebp-dev libudev-dev \
|
||||
liblzma-dev libexiv2-dev libbz2-dev libattr1-dev libacl1-dev \
|
||||
liblzma-dev libexiv2-dev libbz2-dev libacl1-dev \
|
||||
libcdio-dev strigi libdbusmenu-katie media-player-info \
|
||||
krb5-config shared-mime-info media-player-info xdg-utils ccache
|
||||
|
||||
|
|
|
@ -10,26 +10,22 @@
|
|||
|
||||
include(CheckIncludeFiles)
|
||||
|
||||
check_include_files(attr/libattr.h HAVE_ATTR_LIBATTR_H)
|
||||
check_include_files(sys/xattr.h HAVE_SYS_XATTR_H)
|
||||
check_include_files(sys/acl.h HAVE_SYS_ACL_H)
|
||||
check_include_files(acl/libacl.h HAVE_ACL_LIBACL_H)
|
||||
|
||||
if(HAVE_ATTR_LIBATTR_H AND HAVE_SYS_XATTR_H AND HAVE_SYS_ACL_H AND HAVE_ACL_LIBACL_H)
|
||||
if(HAVE_SYS_ACL_H AND HAVE_ACL_LIBACL_H)
|
||||
set(ACL_HEADERS_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if (ACL_HEADERS_FOUND)
|
||||
find_library(ACL_LIBS NAMES acl )
|
||||
|
||||
find_library(ATTR_LIBS NAMES attr )
|
||||
find_library(ACL_LIBS NAMES acl)
|
||||
endif()
|
||||
|
||||
if(ACL_HEADERS_FOUND AND ACL_LIBS AND ATTR_LIBS)
|
||||
if(ACL_HEADERS_FOUND AND ACL_LIBS)
|
||||
set(ACL_FOUND TRUE)
|
||||
set(ACL_LIBS ${ACL_LIBS} ${ATTR_LIBS})
|
||||
set(ACL_LIBS ${ACL_LIBS})
|
||||
message(STATUS "Found ACL support: ${ACL_LIBS}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(ACL_LIBS ATTR_LIBS)
|
||||
mark_as_advanced(ACL_LIBS)
|
||||
|
||||
|
|
|
@ -75,9 +75,7 @@ extern "C" {
|
|||
#include <QtCore/qvarlengtharray.h>
|
||||
|
||||
#ifdef HAVE_POSIX_ACL
|
||||
extern "C" {
|
||||
# include <sys/xattr.h>
|
||||
}
|
||||
#include <sys/acl.h>
|
||||
#endif
|
||||
|
||||
#include <kauthorized.h>
|
||||
|
@ -1846,13 +1844,12 @@ KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin( KPropertiesDialog *_pr
|
|||
static bool fileSystemSupportsACL( const QByteArray& path )
|
||||
{
|
||||
bool fileSystemSupportsACLs = false;
|
||||
#if defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
|
||||
struct statfs buf;
|
||||
fileSystemSupportsACLs = ( statfs( path.data(), &buf ) == 0 ) && ( buf.f_flags & MNT_ACLS );
|
||||
#else
|
||||
fileSystemSupportsACLs =
|
||||
getxattr( path.data(), "system.posix_acl_access", NULL, 0 ) >= 0 || errno == ENODATA;
|
||||
#endif
|
||||
errno = 0;
|
||||
acl_t aclresult = acl_get_file(path.constData(), ACL_TYPE_ACCESS);
|
||||
if (aclresult) {
|
||||
fileSystemSupportsACLs = (errno != ENOTSUP);
|
||||
acl_free(aclresult);
|
||||
}
|
||||
return fileSystemSupportsACLs;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue