diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
commit | a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch) | |
tree | 1c32737389b2530e7152dc2287161b36d9001e8c /src/backend/utils/adt/acl.c | |
parent | cff23842a4c68301ddf34559c7af383bb5557054 (diff) | |
download | postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.zip |
Change SearchSysCache coding conventions so that a reference count is
maintained for each cache entry. A cache entry will not be freed until
the matching ReleaseSysCache call has been executed. This eliminates
worries about cache entries getting dropped while still in use. See
my posting to pg-hackers of even date for more info.
Diffstat (limited to 'src/backend/utils/adt/acl.c')
-rw-r--r-- | src/backend/utils/adt/acl.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 1a2b2ef953e..a8bc5e349a3 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.52 2000/11/03 19:01:36 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.53 2000/11/16 22:30:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -174,12 +174,13 @@ aclparse(char *s, AclItem *aip, unsigned *modechg) switch (aip->ai_idtype) { case ACL_IDTYPE_UID: - htup = SearchSysCacheTuple(SHADOWNAME, - PointerGetDatum(name), - 0, 0, 0); + htup = SearchSysCache(SHADOWNAME, + PointerGetDatum(name), + 0, 0, 0); if (!HeapTupleIsValid(htup)) elog(ERROR, "aclparse: non-existent user \"%s\"", name); aip->ai_id = ((Form_pg_shadow) GETSTRUCT(htup))->usesysid; + ReleaseSysCache(htup); break; case ACL_IDTYPE_GID: aip->ai_id = get_grosysid(name); @@ -272,9 +273,9 @@ aclitemout(PG_FUNCTION_ARGS) switch (aip->ai_idtype) { case ACL_IDTYPE_UID: - htup = SearchSysCacheTuple(SHADOWSYSID, - ObjectIdGetDatum(aip->ai_id), - 0, 0, 0); + htup = SearchSysCache(SHADOWSYSID, + ObjectIdGetDatum(aip->ai_id), + 0, 0, 0); if (!HeapTupleIsValid(htup)) { /* Generate numeric UID if we don't find an entry */ @@ -286,9 +287,12 @@ aclitemout(PG_FUNCTION_ARGS) pfree(tmp); } else + { strncat(p, (char *) &((Form_pg_shadow) GETSTRUCT(htup))->usename, sizeof(NameData)); + ReleaseSysCache(htup); + } break; case ACL_IDTYPE_GID: strcat(p, "group "); |