From 2d4ff1dcd044c09dd6368b6726d53b4f3afcd546 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 18 Apr 2024 16:29:17 -0400 Subject: config: Check for acl_is_trivial_np() --- config/acl-is-trivial-np.c | 11 +++++++++++ config/header.mk | 1 + src/fsade.c | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 config/acl-is-trivial-np.c diff --git a/config/acl-is-trivial-np.c b/config/acl-is-trivial-np.c new file mode 100644 index 0000000..4178238 --- /dev/null +++ b/config/acl-is-trivial-np.c @@ -0,0 +1,11 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +int main(void) { + acl_t acl = acl_get_fd(3); + int trivial; + acl_is_trivial_np(acl, &trivial); + return 0; +} diff --git a/config/header.mk b/config/header.mk index b6915d5..20cb7ae 100644 --- a/config/header.mk +++ b/config/header.mk @@ -9,6 +9,7 @@ include config/exports.mk # All header fragments we generate HEADERS := \ + ${GEN}/acl-is-trivial-np.h \ ${GEN}/confstr.h \ ${GEN}/getdents.h \ ${GEN}/getdents64.h \ diff --git a/src/fsade.c b/src/fsade.c index 34a4d57..51b629f 100644 --- a/src/fsade.c +++ b/src/fsade.c @@ -199,7 +199,7 @@ static int bfs_check_acl_type(acl_t acl, acl_type_t type) { return bfs_check_posix1e_acl(acl, false); } -#if __FreeBSD__ +#if BFS_HAS_ACL_IS_TRIVIAL_NP int trivial; int ret = acl_is_trivial_np(acl, &trivial); @@ -213,7 +213,7 @@ static int bfs_check_acl_type(acl_t acl, acl_type_t type) { } else { return 1; } -#else // !__FreeBSD__ +#else return bfs_check_posix1e_acl(acl, true); #endif } -- cgit v1.2.3