FreeBSD Bugzilla – Attachment 14903 Details for
Bug 27830
pax's uid/gid cache is read-only
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.96 KB, created by
mwatson
on 2001-06-02 06:50:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
mwatson
Created:
2001-06-02 06:50:00 UTC
Size:
3.96 KB
patch
obsolete
>Index: cache.c >=================================================================== >RCS file: /cvs/Darwin/Commands/BSD/file_cmds/pax/cache.c,v >retrieving revision 1.1 >retrieving revision 1.3 >diff -w -u -b -r1.1 -r1.3 >--- cache.c 1999/04/23 02:39:07 1.1 >+++ cache.c 2001/01/16 23:20:28 1.3 >@@ -210,14 +210,15 @@ > { > register struct passwd *pw; > register UIDC *ptr; >- >+ register int hash; > if ((uidtb == NULL) && (uidtb_start() < 0)) > return(""); > > /* > * see if we have this uid cached > */ >- ptr = uidtb[uid % UID_SZ]; >+ hash = uid % UID_SZ; >+ ptr = uidtb[hash]; > if ((ptr != NULL) && (ptr->valid > 0) && (ptr->uid == uid)) { > /* > * have an entry for this uid >@@ -252,6 +253,7 @@ > (void)snprintf(ptr->name, sizeof(ptr->name), "%lu", > (unsigned long)uid); > # endif >+ uidtb[hash] = ptr; > if (frc == 0) > return(""); > } else { >@@ -264,6 +266,7 @@ > (void)strncpy(ptr->name, pw->pw_name, UNMLEN-1); > ptr->name[UNMLEN-1] = '\0'; > ptr->valid = VALID; >+ uidtb[hash] = ptr; > } > return(ptr->name); > } >@@ -288,6 +291,7 @@ > { > register struct group *gr; > register GIDC *ptr; >+ register int hash; > > if ((gidtb == NULL) && (gidtb_start() < 0)) > return(""); >@@ -295,7 +299,8 @@ > /* > * see if we have this gid cached > */ >- ptr = gidtb[gid % GID_SZ]; >+ hash = gid % GID_SZ; >+ ptr = gidtb[hash]; > if ((ptr != NULL) && (ptr->valid > 0) && (ptr->gid == gid)) { > /* > * have an entry for this gid >@@ -330,6 +335,7 @@ > (void)snprintf(ptr->name, sizeof(ptr->name), "%lu", > (unsigned long)gid); > # endif >+ gidtb[hash] = ptr; > if (frc == 0) > return(""); > } else { >@@ -342,6 +348,7 @@ > (void)strncpy(ptr->name, gr->gr_name, GNMLEN-1); > ptr->name[GNMLEN-1] = '\0'; > ptr->valid = VALID; >+ gidtb[hash] = ptr; > } > return(ptr->name); > } >@@ -366,6 +373,7 @@ > register struct passwd *pw; > register UIDC *ptr; > register int namelen; >+ register int hash; > > /* > * return -1 for mangled names >@@ -379,7 +387,8 @@ > * look up in hash table, if found and valid return the uid, > * if found and invalid, return a -1 > */ >- ptr = usrtb[st_hash(name, namelen, UNM_SZ)]; >+ hash = st_hash(name, namelen, UNM_SZ); >+ ptr = usrtb[hash]; > if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) { > if (ptr->valid == INVALID) > return(-1); >@@ -405,6 +414,7 @@ > *uid = pw->pw_uid; > return(0); > } >+ usrtb[hash] = ptr; > (void)strncpy(ptr->name, name, UNMLEN-1); > ptr->name[UNMLEN-1] = '\0'; > if ((pw = getpwnam(name)) == NULL) { >@@ -436,6 +446,7 @@ > register struct group *gr; > register GIDC *ptr; > register int namelen; >+ register int hash; > > /* > * return -1 for mangled names >@@ -449,7 +460,8 @@ > * look up in hash table, if found and valid return the uid, > * if found and invalid, return a -1 > */ >- ptr = grptb[st_hash(name, namelen, GID_SZ)]; >+ hash = st_hash(name, namelen, GID_SZ); >+ ptr = grptb[hash]; > if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) { > if (ptr->valid == INVALID) > return(-1); >@@ -475,6 +487,7 @@ > return(0); > } > >+ grptb[hash] = ptr; > (void)strncpy(ptr->name, name, GNMLEN-1); > ptr->name[GNMLEN-1] = '\0'; > if ((gr = getgrnam(name)) == NULL) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 27830
: 14903