Skip to content

Commit 301ca0d

Browse files
committed
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.
1 parent b1fc51a commit 301ca0d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

contrib/pgrowlocks/pgrowlocks.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ pgrowlocks(PG_FUNCTION_ARGS)
101101

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

107108
if (aclresult != ACLCHECK_OK)
108109
aclcheck_error(aclresult, ACL_KIND_CLASS,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy