Project

General

Profile

Bug #9856 ยป process-allocv_n.patch

normalperson (Eric Wong), 05/20/2014 02:17 AM

View differences:

process.c
static VALUE
proc_getgroups(VALUE obj)
{
VALUE ary;
VALUE ary, tmp;
int i, ngroups;
rb_gid_t *groups;
......
if (ngroups == -1)
rb_sys_fail(0);
groups = ALLOCA_N(rb_gid_t, ngroups);
groups = ALLOCV_N(rb_gid_t, tmp, ngroups);
ngroups = getgroups(ngroups, groups);
if (ngroups == -1)
......
for (i = 0; i < ngroups; i++)
rb_ary_push(ary, GIDT2NUM(groups[i]));
ALLOCV_END(tmp);
return ary;
}
#else
......
{
int ngroups, i;
rb_gid_t *groups;
VALUE tmp;
PREPARE_GETGRNAM;
Check_Type(ary, T_ARRAY);
......
if (ngroups > maxgroups())
rb_raise(rb_eArgError, "too many groups, %d max", maxgroups());
groups = ALLOCA_N(rb_gid_t, ngroups);
groups = ALLOCV_N(rb_gid_t, tmp, ngroups);
for (i = 0; i < ngroups; i++) {
VALUE g = RARRAY_AREF(ary, i);
......
if (setgroups(ngroups, groups) == -1) /* ngroups <= maxgroups */
rb_sys_fail(0);
ALLOCV_END(tmp);
return proc_getgroups(obj);
}
#else
-
    (1-1/1)