MCPcopy Create free account
hub / github.com/coreutils/coreutils / fd_has_acl

Function fd_has_acl

src/copy.c:659–673  ·  view source on GitHub ↗

Return true if FD has a nontrivial ACL. */

Source from the content-addressed store, hash-verified

657# include <sys/acl.h>
658/* Return true if FD has a nontrivial ACL. */
659static bool
660fd_has_acl (int fd)
661{
662 /* Every platform with fclonefileat (macOS 10.12 or later) also has
663 acl_get_fd_np. */
664 bool has_acl = false;
665 acl_t acl = acl_get_fd_np (fd, ACL_TYPE_EXTENDED);
666 if (acl)
667 {
668 acl_entry_t ace;
669 has_acl = 0 <= acl_get_entry (acl, ACL_FIRST_ENTRY, &ace);
670 acl_free (acl);
671 }
672 return has_acl;
673}
674#endif
675
676/* Handle failure from FICLONE or fclonefileat.

Callers 1

copy_regFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected