From 23e7a4e285767b613349038b8601372e214342ec Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 13 May 2012 14:00:16 +0000 Subject: [PATCH] * 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 --- ChangeLog | 7 +++++++ ext/etc/etc.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 472f123a48..e0e6905007 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun May 13 22:46:36 2012 Tanaka Akira + + * 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 * ext/date/date_strftime.c: removed unused code and changed the style. diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 56aab7fb7f..1c1ab813d9 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; }