Skip to content

Commit

Permalink
Fix AclResult vs bool type mix-up
Browse files Browse the repository at this point in the history
Using AclResult as a bool or vice versa works by accident, but it's
unusual and possibly confusing style, so write it out more explicitly.
  • Loading branch information
petere committed Apr 6, 2017
1 parent b1fc51a commit 301ca0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contrib/pgrowlocks/pgrowlocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ pgrowlocks(PG_FUNCTION_ARGS)

/* check permissions: must have SELECT on table or be in pg_stat_scan_tables */
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
ACL_SELECT) ||
is_member_of_role(GetUserId(), DEFAULT_ROLE_STAT_SCAN_TABLES);
ACL_SELECT);
if (aclresult != ACLCHECK_OK)
aclresult = is_member_of_role(GetUserId(), DEFAULT_ROLE_STAT_SCAN_TABLES) ? ACLCHECK_OK : ACLCHECK_NO_PRIV;

if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, ACL_KIND_CLASS,
Expand Down

0 comments on commit 301ca0d

Please sign in to comment.