diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-27 10:04:11 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-27 10:04:11 +0000 |
commit | 9e48333190cb95ecd4d8a49eed103518457e8ace (patch) | |
tree | 0a28d6aa4707629c5d106e979c316c5b65b72e60 /dir.c | |
parent | 043c693d6a7521604ced80a0619d38b4f187f1c9 (diff) |
tcltklib/gtk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -83,8 +83,9 @@ dir_s_open(dir_class, dirname) obj = Data_Wrap_Struct(dir_class, 0, free_dir, dirp); - if (iterator_p()) + if (iterator_p()) { rb_ensure(rb_yield, obj, dir_close, obj); + } return obj; } @@ -112,9 +113,10 @@ dir_read(dir) dp = readdir(dirp); if (dp) return str_taint(str_new(dp->d_name, NAMLEN(dp))); + else if (errno == 0) { /* end of stream */ + return Qnil; + } else { - if (errno == 0) /* end of stream */ - return Qnil; rb_sys_fail(0); } } |