Skip to content

Commit

Permalink
Improve ACL clearing support (fixing FreeBSD build)
Browse files Browse the repository at this point in the history
The problem was that f880469 forgot
that the `#include <sys/xattr.h>` was guarded by an `#ifdef __linux__`.

However, the build failure was only on FreeBSD --- turns out other
platforms have this header too!

The fix therefore uses a new configure check so we properly clear ACLs
on more platforms.
  • Loading branch information
Ericson2314 committed Nov 30, 2023
1 parent a8fea5a commit a7115a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ case "$host_os" in
esac
AC_SUBST(HAVE_SECCOMP, [$have_seccomp])

# Optional dependencies for better normalizing file system data
AC_CHECK_HEADERS[sys/xattr.h]

# Look for aws-cpp-sdk-s3.
AC_LANG_PUSH(C++)
Expand Down
1 change: 0 additions & 1 deletion src/libstore/local-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <sys/statvfs.h>
#include <sys/mount.h>
#include <sys/ioctl.h>
#include <sys/xattr.h>
#endif

#ifdef __CYGWIN__
Expand Down
6 changes: 4 additions & 2 deletions src/libstore/posix-fs-canonicalise.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <sys/xattr.h>
#if HAVE_SYS_XATTR_H
# include <sys/xattr.h>
#endif

#include "posix-fs-canonicalise.hh"
#include "file-system.hh"
Expand Down Expand Up @@ -76,7 +78,7 @@ static void canonicalisePathMetaData_(
if (!(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode)))
throw Error("file '%1%' has an unsupported type", path);

#if __linux__
#ifdef HAVE_SYS_XATTR_H
/* Remove extended attributes / ACLs. */
ssize_t eaSize = llistxattr(path.c_str(), nullptr, 0);

Expand Down

0 comments on commit a7115a4

Please sign in to comment.