From owner-svn-src-all@FreeBSD.ORG Thu Jun 3 14:29:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E5DD106566B; Thu, 3 Jun 2010 14:29:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3308E8FC20; Thu, 3 Jun 2010 14:29:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o53ETIv5004990; Thu, 3 Jun 2010 14:29:18 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53ETITc004985; Thu, 3 Jun 2010 14:29:18 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031429.o53ETITc004985@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 14:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208785 - head/lib/libc/posix1e X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 14:29:18 -0000 Author: trasz Date: Thu Jun 3 14:29:17 2010 New Revision: 208785 URL: http://svn.freebsd.org/changeset/base/208785 Log: _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 Modified: head/lib/libc/posix1e/acl_set.c head/lib/libc/posix1e/acl_support.c head/lib/libc/posix1e/acl_support.h head/lib/libc/posix1e/acl_valid.c Modified: head/lib/libc/posix1e/acl_set.c ============================================================================== --- head/lib/libc/posix1e/acl_set.c Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_set.c Thu Jun 3 14:29:17 2010 (r208785) @@ -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_typ 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_typ 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_ 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_typ 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; Modified: head/lib/libc/posix1e/acl_support.c ============================================================================== --- head/lib/libc/posix1e/acl_support.c Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_support.c Thu Jun 3 14:29:17 2010 (r208785) @@ -127,11 +127,9 @@ _posix1e_acl_entry_compare(struct acl_en } /* - * _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); } /* Modified: head/lib/libc/posix1e/acl_support.h ============================================================================== --- head/lib/libc/posix1e/acl_support.h Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_support.h Thu Jun 3 14:29:17 2010 (r208785) @@ -50,7 +50,7 @@ int _nfs4_format_access_mask(char *str, 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); Modified: head/lib/libc/posix1e/acl_valid.c ============================================================================== --- head/lib/libc/posix1e/acl_valid.c Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_valid.c Thu Jun 3 14:29:17 2010 (r208785) @@ -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 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 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;