summaryrefslogtreecommitdiff
path: root/ext/etc
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-13 14:00:16 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-13 14:00:16 +0000
commit23e7a4e285767b613349038b8601372e214342ec (patch)
tree83351eac0fca4a83e00fa18af3c912d3947da913 /ext/etc
parentb1984f9d52e70dca65369b6a6a67c3881067a6ab (diff)
* 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
Diffstat (limited to 'ext/etc')
-rw-r--r--ext/etc/etc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 56aab7f..1c1ab81 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -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;
}