зеркало из https://github.com/github/ruby.git
* file.c (rb_group_member): added an error check. SUS says,
getgroups(small_value) may return EINVAL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e93a68abfa
Коммит
8a9dc061f5
|
@ -1,3 +1,8 @@
|
|||
Thu Feb 21 13:47:59 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* file.c (rb_group_member): added an error check. SUS says,
|
||||
getgroups(small_value) may return EINVAL.
|
||||
|
||||
Thu Feb 21 13:37:07 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* file.c (RB_MAX_GROUPS): moved to
|
||||
|
|
4
file.c
4
file.c
|
@ -1036,7 +1036,7 @@ rb_group_member(GETGROUPS_T gid)
|
|||
while (groups <= RB_MAX_GROUPS) {
|
||||
gary = ALLOCV_N(GETGROUPS_T, v, groups);
|
||||
anum = getgroups(groups, gary);
|
||||
if (anum != groups)
|
||||
if (anum != -1 && anum != groups)
|
||||
break;
|
||||
groups *= 2;
|
||||
if (v) {
|
||||
|
@ -1044,6 +1044,8 @@ rb_group_member(GETGROUPS_T gid)
|
|||
v = 0;
|
||||
}
|
||||
}
|
||||
if (anum == -1)
|
||||
return FALSE;
|
||||
|
||||
while (--anum >= 0) {
|
||||
if (gary[anum] == gid) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче