summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/dir.c b/dir.c
index a3006f5d0f..677250adbb 100644
--- a/dir.c
+++ b/dir.c
@@ -321,12 +321,11 @@ dir_each(dir)
{
DIR *dirp;
struct dirent *dp;
- VALUE file;
GetDIR(dir, dirp);
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
- file = rb_tainted_str_new(dp->d_name, NAMLEN(dp));
- rb_yield(file);
+ rb_yield(rb_tainted_str_new(dp->d_name, NAMLEN(dp)));
+ if (DATA_PTR(dir) == NULL) dir_closed();
}
return dir;
}