Project

General

Profile

0001-file.c-rb_group_member-kill-256K-of-stack-usage.patch

normalperson (Eric Wong), 04/11/2011 04:01 PM

View differences:

file.c
982 982
static int
983 983
rb_group_member(GETGROUPS_T gid)
984 984
{
985
    int rv = FALSE;
985 986
#ifndef _WIN32
986 987
    if (getgid() == gid || getegid() == gid)
987 988
	return TRUE;
......
995 996
#   endif
996 997
#  endif
997 998
    {
998
	GETGROUPS_T gary[NGROUPS];
999
	GETGROUPS_T *gary;
999 1000
	int anum;
1000 1001

  
1002
	gary = xmalloc(NGROUPS * sizeof(GETGROUPS_T));
1001 1003
	anum = getgroups(NGROUPS, gary);
1002
	while (--anum >= 0)
1003
	    if (gary[anum] == gid)
1004
		return TRUE;
1004
	while (--anum >= 0) {
1005
	    if (gary[anum] == gid) {
1006
		rv = TRUE;
1007
		break;
1008
	    }
1009
	}
1010
	xfree(gary);
1005 1011
    }
1006 1012
# endif
1007 1013
#endif
1008
    return FALSE;
1014
    return rv;
1009 1015
}
1010 1016

  
1011 1017
#ifndef S_IXUGO