ruby-changes:19001
From: kosaki <ko1@a...>
Date: Mon, 7 Mar 2011 00:27:26 +0900 (JST)
Subject: [ruby-changes:19001] Ruby:r31037 (trunk): * process.c (proc_getgroups): get rid of maxgroups dependency.
kosaki 2011-03-07 00:25:58 +0900 (Mon, 07 Mar 2011) New Revision: 31037 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31037 Log: * process.c (proc_getgroups): get rid of maxgroups dependency. ngroups can be calculated dynamically. Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 31036) +++ ChangeLog (revision 31037) @@ -1,3 +1,8 @@ +Mon Mar 7 00:21:11 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * process.c (proc_getgroups): get rid of maxgroups dependency. + ngroups can be calculated dynamically. + Sun Mar 6 23:45:40 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * configure.in: rlim_t use standard RUBY_REPLACE_TYPE mechanism. Index: process.c =================================================================== --- process.c (revision 31036) +++ process.c (revision 31037) @@ -4563,9 +4563,13 @@ int i, ngroups; rb_gid_t *groups; - groups = ALLOCA_N(rb_gid_t, maxgroups); + ngroups = getgroups(0, NULL); + if (ngroups == -1) + rb_sys_fail(0); - ngroups = getgroups(maxgroups, groups); + groups = ALLOCA_N(rb_gid_t, ngroups); + + ngroups = getgroups(ngroups, groups); if (ngroups == -1) rb_sys_fail(0); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/