struct group *getgrgid(const gid_t gid)
{
	struct group *group;
	int grp_fd;

	if ((grp_fd = open(bb_path_group_file, O_RDONLY)) < 0)
		return NULL;

	while ((group = bb_getgrent(grp_fd)) != NULL)
		if (group->gr_gid == gid) {
			close(grp_fd);
			return group;
		}

	close(grp_fd);
	return NULL;
}
struct group *getgrent(void)
{
	if (grp_fd == -1)
		return NULL;
	return bb_getgrent(grp_fd);
}