X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Flibadacl.c;h=d99cb8f6bfbae32b86503c084d19c3f36061aae7;hb=da44faa5462beba8cfaf35a353438e27422e5e39;hp=20bb715ea7b5e429911061511f09226bf065e2ce;hpb=eb1715a253bcbf3a6ae51403b34cd6a20b894ec1;p=apply-default-acl.git diff --git a/src/libadacl.c b/src/libadacl.c index 20bb715..d99cb8f 100644 --- a/src/libadacl.c +++ b/src/libadacl.c @@ -127,7 +127,7 @@ int safe_open_ex(int at_fd, char* pathname, int flags) { * and @c OPEN_ERROR if not. */ int safe_open(const char* pathname, int flags) { - if (pathname == NULL || strlen(pathname) == 0 || pathname[0] == '\0') { + if (pathname == NULL) { errno = EINVAL; perror("safe_open (args)"); return OPEN_ERROR; @@ -551,38 +551,6 @@ int any_can_execute(int fd, const struct stat* sp) { -/** - * @brief Remove all @c ACL_TYPE_ACCESS entries from the given file - * descriptor, leaving the UNIX permission bits. - * - * @param fd - * The file descriptor whose ACLs we want to wipe. - * - * @return - * - @c ACL_SUCCESS - The ACLs were wiped successfully, or none - * existed in the first place. - * - @c ACL_ERROR - Unexpected library error. - */ -int wipe_acls(int fd) { - /* Initialize an empty ACL, and then overwrite the one on "fd" with it. */ - acl_t empty_acl = acl_init(0); - - if (empty_acl == (acl_t)NULL) { - perror("wipe_acls (acl_init)"); - return ACL_ERROR; - } - - if (acl_set_fd(fd, empty_acl) == ACL_ERROR) { - perror("wipe_acls (acl_set_fd)"); - acl_free(empty_acl); - return ACL_ERROR; - } - - acl_free(empty_acl); - return ACL_SUCCESS; -} - - /** * @brief Copy ACLs between file descriptors as xattrs, verbatim. * @@ -849,12 +817,6 @@ int apply_default_acl_ex(const char* path, allow_exec = (bool)ace_result; } - if (wipe_acls(fd) == ACL_ERROR) { - perror("apply_default_acl_ex (wipe_acls)"); - result = ACL_ERROR; - goto cleanup; - } - /* If it's a directory, inherit the parent's default. */ if (S_ISDIR(sp->st_mode)) { if (acl_copy_xattr(parent_fd,