>From 9d6bb056bf71db9c377a7da616fe24f0ea393057 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 4 Jul 2015 11:05:00 -0700 Subject: [PATCH] file-has-acl, acl-permissions: fix HP-UX typos Problem reported by John David Anglin in: http://bugs.gnu.org/20979 * lib/file-has-acl.c (file_has_acl): * lib/set-permissions.c (context_acl_from_mode) (context_aclv_from_mode, set_acls): Fix some obvious typos when HAVE_GETCL /* HP-UX */. They were introduced by the recent ACL changes. --- ChangeLog | 8 ++++++++ lib/file-has-acl.c | 2 +- lib/set-permissions.c | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4931868..d6b184a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2015-07-04 Paul Eggert + file-has-acl, acl-permissions: fix HP-UX typos + Problem reported by John David Anglin in: http://bugs.gnu.org/20979 + * lib/file-has-acl.c (file_has_acl): + * lib/set-permissions.c (context_acl_from_mode) + (context_aclv_from_mode, set_acls): + Fix some obvious typos when HAVE_GETCL /* HP-UX */. + They were introduced by the recent ACL changes. + regex: match current GNU grep behavior These symbols have not matched GNU grep behavior for quite some time. Fix prompted by Balazs Kezes bug report at: http://bugs.gnu.org/20974 diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c index 8488b7e..b78a879 100644 --- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -349,7 +349,7 @@ file_has_acl (char const *name, struct stat const *sb) if (stat (name, &statbuf) < 0) return -1; - return acl_nontrivial (count, entries, &statbuf); + return acl_nontrivial (count, entries); } } } diff --git a/lib/set-permissions.c b/lib/set-permissions.c index a96b86c..41f6cb2 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c @@ -288,13 +288,13 @@ context_acl_from_mode (struct permission_context *ctx, const char *name, int des ctx->entries[0].uid = statbuf.st_uid; ctx->entries[0].gid = ACL_NSGROUP; - ctx->entries[0].mode = (mode >> 6) & 7; + ctx->entries[0].mode = (ctx->mode >> 6) & 7; ctx->entries[1].uid = ACL_NSUSER; ctx->entries[1].gid = statbuf.st_gid; - ctx->entries[1].mode = (mode >> 3) & 7; + ctx->entries[1].mode = (ctx->mode >> 3) & 7; ctx->entries[2].uid = ACL_NSUSER; ctx->entries[2].gid = ACL_NSGROUP; - ctx->entries[2].mode = mode & 7; + ctx->entries[2].mode = ctx->mode & 7; ctx->count = 3; return 0; } @@ -319,7 +319,7 @@ context_aclv_from_mode (struct permission_context *ctx) ctx->aclv_entries[3].a_perm = mode & 7; ctx->aclv_count = 4; - ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries); + ret = aclsort (ctx->aclv_count, 1, entries); if (ret > 0) abort (); return ret; @@ -461,19 +461,19 @@ context_acl_from_mode (struct permission_context *ctx) ctx->entries[0].a_type = USER_OBJ; ctx->entries[0].a_id = 0; /* irrelevant */ - ctx->entries[0].a_perm = (mode >> 6) & 7; + ctx->entries[0].a_perm = (ctx->mode >> 6) & 7; ctx->entries[1].a_type = GROUP_OBJ; ctx->entries[1].a_id = 0; /* irrelevant */ - ctx->entries[1].a_perm = (mode >> 3) & 7; + ctx->entries[1].a_perm = (ctx->mode >> 3) & 7; ctx->entries[2].a_type = CLASS_OBJ; ctx->entries[2].a_id = 0; - ctx->entries[2].a_perm = (mode >> 3) & 7; + ctx->entries[2].a_perm = (ctx->mode >> 3) & 7; ctx->entries[3].a_type = OTHER_OBJ; ctx->entries[3].a_id = 0; - ctx->entries[3].a_perm = mode & 7; + ctx->entries[3].a_perm = ctx->mode & 7; ctx->count = 4; - ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries); + ret = aclsort (ctx->count, 1, entries); if (ret > 0) abort (); return ret; @@ -660,7 +660,7 @@ set_acls (struct permission_context *ctx, const char *name, int desc, if (ret < 0) { if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP) - && (from_mode || !acl_nontrivial (ctx->count, ctx->entries, &source_statbuf))) + && (from_mode || !acl_nontrivial (ctx->count, ctx->entries))) ret = 0; } else -- 2.1.0