Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* 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
  • Loading branch information...
commit 23e7a4e285767b613349038b8601372e214342ec 1 parent b1984f9
@akr akr authored
Showing with 9 additions and 2 deletions.
  1. +7 −0 ChangeLog
  2. +2 −2 ext/etc/etc.c
View
7 ChangeLog
@@ -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
4 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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.