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

* ext/etc/etc.c (passwd_ensure): move endpwent() call from

passwd_iterate to close /etc/passwd on exception.
  (group_ensure): move endgrent() call from group_iterate to close
  /etc/group on exception.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2012-05-13 14:00:16 +00:00
parent b1984f9d52
commit 23e7a4e285
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,10 @@
Sun May 13 22:46:36 2012 Tanaka Akira <akr@fsij.org>
* ext/etc/etc.c (passwd_ensure): move endpwent() call from
passwd_iterate to close /etc/passwd on exception.
(group_ensure): move endgrent() call from group_iterate to close
/etc/group on exception.
Sun May 13 18:10:43 2012 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_strftime.c: removed unused code and changed the style.

View file

@ -174,6 +174,7 @@ static int passwd_blocking = 0;
static VALUE
passwd_ensure(void)
{
endpwent();
passwd_blocking = (int)Qfalse;
return Qnil;
}
@ -187,7 +188,6 @@ passwd_iterate(void)
while (pw = getpwent()) {
rb_yield(setup_passwd(pw));
}
endpwent();
return Qnil;
}
@ -412,6 +412,7 @@ static int group_blocking = 0;
static VALUE
group_ensure(void)
{
endgrent();
group_blocking = (int)Qfalse;
return Qnil;
}
@ -425,7 +426,6 @@ group_iterate(void)
while (pw = getgrent()) {
rb_yield(setup_group(pw));
}
endgrent();
return Qnil;
}