On Mon, 10 Sep 2018, Todd C. Miller wrote: > This is a port of uid_from_user() and gid_from_group() from NetBSD (also > present in FreeBSD). ... > --- lib/libc/gen/pwcache.c 25 Nov 2015 23:16:01 -0000 1.13 > +++ lib/libc/gen/pwcache.c 10 Sep 2018 15:04:35 -0000 ... > +/* > + * routines that control user, group, uid and gid caches (for the archive > + * member print routine).
The parenthetical side comment should be deleted. I suggest capitalizing 'routines' while there. ... > +const char * > +group_from_gid(gid_t gid, int noname) > +{ > + struct group grstore, *gr = NULL; > + char grbuf[_GR_BUF_LEN]; > + GIDC *ptr, **pptr; > + > + if ((gidtb == NULL) && (gidtb_start() < 0)) > + return NULL; One question is whether these routines should fall back to uncached operation if the allocation fails. "tar -tv" will segfault currently if a [ug]idtb_start() call fails. ... > Index: lib/libc/gen/pwcache.h > =================================================================== > RCS file: lib/libc/gen/pwcache.h I merged cache.h into cache.c in pax because the separate header was pointless; why split these bits into a single-use header again? (...specially because I would maul these data structure a bit...) > Index: lib/libc/gen/getgrent.c > Index: lib/libc/Symbols.list > Index: lib/libc/hidden/grp.h > Index: lib/libc/hidden/pwd.h These bits are all correct and do what you desire. Philip