From owner-svn-src-stable-12@freebsd.org Sat Nov 17 18:53:29 2018 Return-Path: Delivered-To: svn-src-stable-12@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D00041101F99; Sat, 17 Nov 2018 18:53:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7292A797F7; Sat, 17 Nov 2018 18:53:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39A28100; Sat, 17 Nov 2018 18:53:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wAHIrTiZ015537; Sat, 17 Nov 2018 18:53:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wAHIrTTD015536; Sat, 17 Nov 2018 18:53:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201811171853.wAHIrTTD015536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 17 Nov 2018 18:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340500 - stable/12/bin/getfacl X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/bin/getfacl X-SVN-Commit-Revision: 340500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7292A797F7 X-Spamd-Result: default: False [0.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_SHORT(0.04)[0.044,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Nov 2018 18:53:30 -0000 Author: markj Date: Sat Nov 17 18:53:28 2018 New Revision: 340500 URL: https://svnweb.freebsd.org/changeset/base/340500 Log: MFC r340014: Avoid copying a struct stat for acl_from_stat() calls. Modified: stable/12/bin/getfacl/getfacl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/getfacl/getfacl.c ============================================================================== --- stable/12/bin/getfacl/getfacl.c Sat Nov 17 18:51:22 2018 (r340499) +++ stable/12/bin/getfacl/getfacl.c Sat Nov 17 18:53:28 2018 (r340500) @@ -88,7 +88,7 @@ getgname(gid_t gid) * contained in struct stat */ static acl_t -acl_from_stat(struct stat sb) +acl_from_stat(const struct stat *sb) { acl_t acl; acl_entry_t entry; @@ -111,13 +111,13 @@ acl_from_stat(struct stat sb) return NULL; /* calculate user mode */ - if (sb.st_mode & S_IRUSR) + if (sb->st_mode & S_IRUSR) if (acl_add_perm(perms, ACL_READ) == -1) return NULL; - if (sb.st_mode & S_IWUSR) + if (sb->st_mode & S_IWUSR) if (acl_add_perm(perms, ACL_WRITE) == -1) return NULL; - if (sb.st_mode & S_IXUSR) + if (sb->st_mode & S_IXUSR) if (acl_add_perm(perms, ACL_EXECUTE) == -1) return NULL; if (acl_set_permset(entry, perms) == -1) @@ -135,13 +135,13 @@ acl_from_stat(struct stat sb) return NULL; /* calculate group mode */ - if (sb.st_mode & S_IRGRP) + if (sb->st_mode & S_IRGRP) if (acl_add_perm(perms, ACL_READ) == -1) return NULL; - if (sb.st_mode & S_IWGRP) + if (sb->st_mode & S_IWGRP) if (acl_add_perm(perms, ACL_WRITE) == -1) return NULL; - if (sb.st_mode & S_IXGRP) + if (sb->st_mode & S_IXGRP) if (acl_add_perm(perms, ACL_EXECUTE) == -1) return NULL; if (acl_set_permset(entry, perms) == -1) @@ -159,13 +159,13 @@ acl_from_stat(struct stat sb) return NULL; /* calculate other mode */ - if (sb.st_mode & S_IROTH) + if (sb->st_mode & S_IROTH) if (acl_add_perm(perms, ACL_READ) == -1) return NULL; - if (sb.st_mode & S_IWOTH) + if (sb->st_mode & S_IWOTH) if (acl_add_perm(perms, ACL_WRITE) == -1) return NULL; - if (sb.st_mode & S_IXOTH) + if (sb->st_mode & S_IXOTH) if (acl_add_perm(perms, ACL_EXECUTE) == -1) return NULL; if (acl_set_permset(entry, perms) == -1) @@ -229,7 +229,7 @@ print_acl(char *path, acl_type_t type, int hflag, int errno = 0; if (type == ACL_TYPE_DEFAULT) return(0); - acl = acl_from_stat(sb); + acl = acl_from_stat(&sb); if (!acl) { warn("%s: acl_from_stat() failed", path); return(-1);