summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-27 02:10:56 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-27 02:10:56 +0000
commitd981b18d0516dcc64e0f1330637275dce3e206ac (patch)
treecd2b82b88b73074d55973523bb879aac1b49ebdb /dir.c
parente2a95883d807684bef9851a293f34d0a3cf5c788 (diff)
* dir.c (dir_each): rewinddir(3) before iteration.
[ruby-talk:149628] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index 4a7025e..ce0e88b 100644
--- a/dir.c
+++ b/dir.c
@@ -409,6 +409,7 @@ dir_each(dir)
struct dirent *dp;
GetDIR(dir, dirp);
+ rewinddir(dirp->dir);
for (dp = readdir(dirp->dir); dp != NULL; dp = readdir(dirp->dir)) {
rb_yield(rb_tainted_str_new(dp->d_name, NAMLEN(dp)));
if (dirp->dir == NULL) dir_closed();