diff options
author | Peter Eisentraut | 2017-04-06 15:31:18 +0000 |
---|---|---|
committer | Peter Eisentraut | 2017-04-06 15:32:07 +0000 |
commit | 301ca0d9a2f82ade11b2e5039d348badd28334cf (patch) | |
tree | 28c3a9196ec57b232420e1216156fd534b6c616e | |
parent | b1fc51a36ecdf854be9e41ffb99953c40ef96ccf (diff) |
Fix AclResult vs bool type mix-up
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.
-rw-r--r-- | contrib/pgrowlocks/pgrowlocks.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c index 120d0eb8db..8dd561c02a 100644 --- a/contrib/pgrowlocks/pgrowlocks.c +++ b/contrib/pgrowlocks/pgrowlocks.c @@ -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, |