git: fcef0684f108 - main - Fix build of bin/getfacl after libc changes.
Gleb Popov
arrowd at FreeBSD.org
Fri Aug 27 08:52:46 UTC 2021
The branch main has been updated by arrowd (ports committer):
URL: https://cgit.FreeBSD.org/src/commit/?id=fcef0684f1084aeacae556adc5d4d5853b7e748e
commit fcef0684f1084aeacae556adc5d4d5853b7e748e
Author: Gleb Popov <arrowd at FreeBSD.org>
AuthorDate: 2021-01-20 09:47:44 +0000
Commit: Gleb Popov <arrowd at FreeBSD.org>
CommitDate: 2021-08-27 08:52:18 +0000
Fix build of bin/getfacl after libc changes.
Reviewed by: kib, debdrup, gbe
Approved by: kib
Differential Revision: https://reviews.freebsd.org/D28255
---
bin/getfacl/getfacl.c | 93 +--------------------------------------------------
1 file changed, 1 insertion(+), 92 deletions(-)
diff --git a/bin/getfacl/getfacl.c b/bin/getfacl/getfacl.c
index d59ddbcfc871..ecdc73f74fbc 100644
--- a/bin/getfacl/getfacl.c
+++ b/bin/getfacl/getfacl.c
@@ -83,97 +83,6 @@ getgname(gid_t gid)
return (gr->gr_name);
}
-/*
- * return an ACL corresponding to the permissions
- * contained in mode_t
- */
-static acl_t
-acl_from_mode(const mode_t mode)
-{
- acl_t acl;
- acl_entry_t entry;
- acl_permset_t perms;
-
- /* create the ACL */
- acl = acl_init(3);
- if (!acl)
- return NULL;
-
- /* First entry: ACL_USER_OBJ */
- if (acl_create_entry(&acl, &entry) == -1)
- return NULL;
- if (acl_set_tag_type(entry, ACL_USER_OBJ) == -1)
- return NULL;
-
- if (acl_get_permset(entry, &perms) == -1)
- return NULL;
- if (acl_clear_perms(perms) == -1)
- return NULL;
-
- /* calculate user mode */
- if (mode & S_IRUSR)
- if (acl_add_perm(perms, ACL_READ) == -1)
- return NULL;
- if (mode & S_IWUSR)
- if (acl_add_perm(perms, ACL_WRITE) == -1)
- return NULL;
- if (mode & S_IXUSR)
- if (acl_add_perm(perms, ACL_EXECUTE) == -1)
- return NULL;
- if (acl_set_permset(entry, perms) == -1)
- return NULL;
-
- /* Second entry: ACL_GROUP_OBJ */
- if (acl_create_entry(&acl, &entry) == -1)
- return NULL;
- if (acl_set_tag_type(entry, ACL_GROUP_OBJ) == -1)
- return NULL;
-
- if (acl_get_permset(entry, &perms) == -1)
- return NULL;
- if (acl_clear_perms(perms) == -1)
- return NULL;
-
- /* calculate group mode */
- if (mode & S_IRGRP)
- if (acl_add_perm(perms, ACL_READ) == -1)
- return NULL;
- if (mode & S_IWGRP)
- if (acl_add_perm(perms, ACL_WRITE) == -1)
- return NULL;
- if (mode & S_IXGRP)
- if (acl_add_perm(perms, ACL_EXECUTE) == -1)
- return NULL;
- if (acl_set_permset(entry, perms) == -1)
- return NULL;
-
- /* Third entry: ACL_OTHER */
- if (acl_create_entry(&acl, &entry) == -1)
- return NULL;
- if (acl_set_tag_type(entry, ACL_OTHER) == -1)
- return NULL;
-
- if (acl_get_permset(entry, &perms) == -1)
- return NULL;
- if (acl_clear_perms(perms) == -1)
- return NULL;
-
- /* calculate other mode */
- if (mode & S_IROTH)
- if (acl_add_perm(perms, ACL_READ) == -1)
- return NULL;
- if (mode & S_IWOTH)
- if (acl_add_perm(perms, ACL_WRITE) == -1)
- return NULL;
- if (mode & S_IXOTH)
- if (acl_add_perm(perms, ACL_EXECUTE) == -1)
- return NULL;
- if (acl_set_permset(entry, perms) == -1)
- return NULL;
-
- return(acl);
-}
-
static int
print_acl(char *path, acl_type_t type, int hflag, int iflag, int nflag,
int qflag, int vflag)
@@ -229,7 +138,7 @@ print_acl(char *path, acl_type_t type, int hflag, int iflag, int nflag,
errno = 0;
if (type == ACL_TYPE_DEFAULT)
return(0);
- acl = acl_from_mode(sb.st_mode);
+ acl = acl_from_mode_np(sb.st_mode);
if (!acl) {
warn("%s: acl_from_mode() failed", path);
return(-1);
More information about the dev-commits-src-main
mailing list