1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) r46075: [Backport #9856]

* process.c (proc_getgroups, proc_setgroups): use ALLOCV_N
	  [Bug #9856]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-06-29 17:43:01 +00:00
parent 7d49e2bfc1
commit 39d963422f
3 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Mon Jun 30 02:36:08 2014 Eric Wong <e@80x24.org>
* process.c (proc_getgroups, proc_setgroups): use ALLOCV_N
[Bug #9856]
Mon Jun 30 02:28:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (io_setstrbuf): always check if the buffer is modifiable.

View file

@ -5662,7 +5662,7 @@ maxgroups(void)
static VALUE
proc_getgroups(VALUE obj)
{
VALUE ary;
VALUE ary, tmp;
int i, ngroups;
rb_gid_t *groups;
@ -5670,7 +5670,7 @@ proc_getgroups(VALUE obj)
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)
@ -5680,6 +5680,8 @@ proc_getgroups(VALUE obj)
for (i = 0; i < ngroups; i++)
rb_ary_push(ary, GIDT2NUM(groups[i]));
ALLOCV_END(tmp);
return ary;
}
#else
@ -5706,6 +5708,7 @@ proc_setgroups(VALUE obj, VALUE ary)
{
int ngroups, i;
rb_gid_t *groups;
VALUE tmp;
PREPARE_GETGRNAM;
Check_Type(ary, T_ARRAY);
@ -5714,7 +5717,7 @@ proc_setgroups(VALUE obj, VALUE ary)
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);
@ -5726,6 +5729,8 @@ proc_setgroups(VALUE obj, VALUE ary)
if (setgroups(ngroups, groups) == -1) /* ngroups <= maxgroups */
rb_sys_fail(0);
ALLOCV_END(tmp);
return proc_getgroups(obj);
}
#else

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-06-30"
#define RUBY_PATCHLEVEL 152
#define RUBY_PATCHLEVEL 153
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 6