diff options
author | rsc <devnull@localhost> | 2006-06-12 17:21:10 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-06-12 17:21:10 +0000 |
commit | 63fcc2bc3c1b37227cc9f5b9b8ca45ce091a1477 (patch) | |
tree | ce5f588e07e5e0acd0a14cee87a6c853086db5b7 /src/lib9 | |
parent | d93cc14ecee8fbb0dc0fc746713aba7ee0979c4c (diff) | |
download | plan9port-63fcc2bc3c1b37227cc9f5b9b8ca45ce091a1477.tar.gz plan9port-63fcc2bc3c1b37227cc9f5b9b8ca45ce091a1477.tar.bz2 plan9port-63fcc2bc3c1b37227cc9f5b9b8ca45ce091a1477.zip |
avoid pw library
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/_p9dir.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c index 57f46489..517dc773 100644 --- a/src/lib9/_p9dir.c +++ b/src/lib9/_p9dir.c @@ -77,6 +77,7 @@ disksize(int fd, int dev) #define _HAVESTGEN #endif +int _p9usepwlibrary = 1; /* * Caching the last group and passwd looked up is * a significant win (stupidly enough) on most systems. @@ -123,11 +124,11 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char * /* user */ if(p && st->st_uid == uid && p->pw_uid == uid) ; - else{ + else if(_p9usepwlibrary){ p = getpwuid(st->st_uid); uid = st->st_uid; } - if(p == nil){ + if(p == nil || st->st_uid != uid || p->pw_uid != uid){ snprint(tmp, sizeof tmp, "%d", (int)st->st_uid); s = tmp; }else @@ -146,11 +147,11 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char * /* group */ if(g && st->st_gid == gid && g->gr_gid == gid) ; - else{ + else if(_p9usepwlibrary){ g = getgrgid(st->st_gid); gid = st->st_gid; } - if(g == nil){ + if(g == nil || st->st_gid != gid || g->gr_gid != gid){ snprint(tmp, sizeof tmp, "%d", (int)st->st_gid); s = tmp; }else |