diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-27 08:27:46 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-27 08:27:46 +0000 |
| commit | 1c8500b3d1a327ff4e56af3c9ed9164130becc74 (patch) | |
| tree | 74afc2d5843879ded6824b009bc2bbfbae288b30 | |
| parent | 322b26795583a0b854e7b195e7f766bd479c0404 (diff) | |
merge revision(s) 46075: [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_0_0@46581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | process.c | 11 | ||||
| -rw-r--r-- | version.h | 2 |
3 files changed, 14 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Fri Jun 27 17:27:26 2014 Eric Wong <e@80x24.org> + + * process.c (proc_getgroups, proc_setgroups): use ALLOCV_N + [Bug #9856] + Fri Jun 27 17:19:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> * io.c (io_setstrbuf): always check if the buffer is modifiable. @@ -5548,7 +5548,7 @@ maxgroups(void) static VALUE proc_getgroups(VALUE obj) { - VALUE ary; + VALUE ary, tmp; int i, ngroups; rb_gid_t *groups; @@ -5556,7 +5556,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) @@ -5566,6 +5566,8 @@ proc_getgroups(VALUE obj) for (i = 0; i < ngroups; i++) rb_ary_push(ary, GIDT2NUM(groups[i])); + ALLOCV_END(tmp); + return ary; } #else @@ -5592,6 +5594,7 @@ proc_setgroups(VALUE obj, VALUE ary) { int ngroups, i; rb_gid_t *groups; + VALUE tmp; PREPARE_GETGRNAM; Check_Type(ary, T_ARRAY); @@ -5600,7 +5603,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_PTR(ary)[i]; @@ -5612,6 +5615,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 @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-06-27" -#define RUBY_PATCHLEVEL 505 +#define RUBY_PATCHLEVEL 506 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 6 |
