_posix1e_acl_sort() never returns anything other than 0; change its
return type to void and update callers. This simplifies code and fixes one place where the returned value was not actually checked. Found with: Coverity Prevent CID: 4791
This commit is contained in:
parent
26f044985f
commit
307713b0cf
@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
|
||||
int
|
||||
acl_set_file(const char *path_p, acl_type_t type, acl_t acl)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (acl == NULL || path_p == NULL) {
|
||||
errno = EINVAL;
|
||||
@ -64,13 +63,8 @@ acl_set_file(const char *path_p, acl_type_t type, acl_t acl)
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
if (_posix1e_acl(acl, type)) {
|
||||
error = _posix1e_acl_sort(acl);
|
||||
if (error) {
|
||||
errno = error;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
if (_posix1e_acl(acl, type))
|
||||
_posix1e_acl_sort(acl);
|
||||
|
||||
acl->ats_cur_entry = 0;
|
||||
|
||||
@ -80,7 +74,6 @@ acl_set_file(const char *path_p, acl_type_t type, acl_t acl)
|
||||
int
|
||||
acl_set_link_np(const char *path_p, acl_type_t type, acl_t acl)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (acl == NULL || path_p == NULL) {
|
||||
errno = EINVAL;
|
||||
@ -91,13 +84,8 @@ acl_set_link_np(const char *path_p, acl_type_t type, acl_t acl)
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
if (_posix1e_acl(acl, type)) {
|
||||
error = _posix1e_acl_sort(acl);
|
||||
if (error) {
|
||||
errno = error;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
if (_posix1e_acl(acl, type))
|
||||
_posix1e_acl_sort(acl);
|
||||
|
||||
acl->ats_cur_entry = 0;
|
||||
|
||||
@ -117,7 +105,6 @@ acl_set_fd(int fd, acl_t acl)
|
||||
int
|
||||
acl_set_fd_np(int fd, acl_t acl, acl_type_t type)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (acl == NULL) {
|
||||
errno = EINVAL;
|
||||
@ -128,13 +115,8 @@ acl_set_fd_np(int fd, acl_t acl, acl_type_t type)
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
if (_posix1e_acl(acl, type)) {
|
||||
error = _posix1e_acl_sort(acl);
|
||||
if (error) {
|
||||
errno = error;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
if (_posix1e_acl(acl, type))
|
||||
_posix1e_acl_sort(acl);
|
||||
|
||||
acl->ats_cur_entry = 0;
|
||||
|
||||
|
@ -127,11 +127,9 @@ _posix1e_acl_entry_compare(struct acl_entry *a, struct acl_entry *b)
|
||||
}
|
||||
|
||||
/*
|
||||
* _posix1e_acl_sort -- sort ACL entries in POSIX.1e-formatted ACLs
|
||||
* Give the opportunity to fail, although we don't currently have a way
|
||||
* to fail.
|
||||
* _posix1e_acl_sort -- sort ACL entries in POSIX.1e-formatted ACLs.
|
||||
*/
|
||||
int
|
||||
void
|
||||
_posix1e_acl_sort(acl_t acl)
|
||||
{
|
||||
struct acl *acl_int;
|
||||
@ -140,8 +138,6 @@ _posix1e_acl_sort(acl_t acl)
|
||||
|
||||
qsort(&acl_int->acl_entry[0], acl_int->acl_cnt,
|
||||
sizeof(struct acl_entry), (compare) _posix1e_acl_entry_compare);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -50,7 +50,7 @@ int _nfs4_format_access_mask(char *str, size_t size, acl_perm_t var, int verbose
|
||||
int _nfs4_parse_flags(const char *str, acl_flag_t *var);
|
||||
int _nfs4_parse_access_mask(const char *str, acl_perm_t *var);
|
||||
int _posix1e_acl_check(acl_t acl);
|
||||
int _posix1e_acl_sort(acl_t acl);
|
||||
void _posix1e_acl_sort(acl_t acl);
|
||||
int _posix1e_acl(acl_t acl, acl_type_t type);
|
||||
int _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len,
|
||||
char *buf, int flags);
|
||||
|
@ -79,20 +79,14 @@ acl_valid(acl_t acl)
|
||||
int
|
||||
acl_valid_file_np(const char *pathp, acl_type_t type, acl_t acl)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (pathp == NULL || acl == NULL) {
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
type = _acl_type_unold(type);
|
||||
if (_posix1e_acl(acl, type)) {
|
||||
error = _posix1e_acl_sort(acl);
|
||||
if (error) {
|
||||
errno = error;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
if (_posix1e_acl(acl, type))
|
||||
_posix1e_acl_sort(acl);
|
||||
|
||||
return (__acl_aclcheck_file(pathp, type, &acl->ats_acl));
|
||||
}
|
||||
@ -100,20 +94,14 @@ acl_valid_file_np(const char *pathp, acl_type_t type, acl_t acl)
|
||||
int
|
||||
acl_valid_link_np(const char *pathp, acl_type_t type, acl_t acl)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (pathp == NULL || acl == NULL) {
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
type = _acl_type_unold(type);
|
||||
if (_posix1e_acl(acl, type)) {
|
||||
error = _posix1e_acl_sort(acl);
|
||||
if (error) {
|
||||
errno = error;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
if (_posix1e_acl(acl, type))
|
||||
_posix1e_acl_sort(acl);
|
||||
|
||||
return (__acl_aclcheck_link(pathp, type, &acl->ats_acl));
|
||||
}
|
||||
@ -121,20 +109,14 @@ acl_valid_link_np(const char *pathp, acl_type_t type, acl_t acl)
|
||||
int
|
||||
acl_valid_fd_np(int fd, acl_type_t type, acl_t acl)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (acl == NULL) {
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
type = _acl_type_unold(type);
|
||||
if (_posix1e_acl(acl, type)) {
|
||||
error = _posix1e_acl_sort(acl);
|
||||
if (error) {
|
||||
errno = error;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
if (_posix1e_acl(acl, type))
|
||||
_posix1e_acl_sort(acl);
|
||||
|
||||
acl->ats_cur_entry = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user