struct group * getgrnam(const char *name) { struct group *p_gr = (struct group*)_THREAD_PRIVATE(gr,_gr_group,NULL); struct group_storage *gs = (struct group_storage *)_THREAD_PRIVATE(gr_storage, gr_storage, NULL); return getgrnam_gs(name, p_gr, gs); }
int getgrnam_r(const char *name, struct group *grp, char *buffer, size_t bufsize, struct group **result) { int errnosave; int ret; if (bufsize < GETGR_R_SIZE_MAX) return ERANGE; errnosave = errno; *result = getgrnam_gs(name, grp, (struct group_storage *)buffer); if (*result == NULL) ret = errno; else ret = 0; errno = errnosave; return ret; }