summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-14 04:55:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-14 04:55:53 +0000
commita1a693e138392467ca74fb4ba5b071dd7675960e (patch)
tree7586388b543e40af025fa9e03a63b442eb254009 /dir.c
parentd453b1a042a4483e74b17d66c7d88ec0c60b964a (diff)
signal delivered to main_thread
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/dir.c b/dir.c
index e2a6fd45ba..a4b8b8db94 100644
--- a/dir.c
+++ b/dir.c
@@ -100,7 +100,6 @@ dir_closed()
if (dirp == NULL) dir_closed();\
}
-#if 0
static VALUE
dir_read(dir)
VALUE dir;
@@ -109,13 +108,16 @@ dir_read(dir)
struct dirent *dp;
GetDIR(dir, dirp);
+ errno = 0;
dp = readdir(dirp);
if (dp)
return str_taint(str_new(dp->d_name, NAMLEN(dp)));
- else
- return Qnil;
+ else {
+ if (errno == 0) /* end of stream */
+ return Qnil;
+ rb_sys_fail(0);
+ }
}
-#endif
static VALUE
dir_each(dir)
@@ -428,9 +430,7 @@ Init_Dir()
rb_define_singleton_method(cDir, "open", dir_s_open, 1);
rb_define_singleton_method(cDir, "foreach", dir_foreach, 1);
-#if 0
rb_define_method(cDir,"read", dir_read, 0);
-#endif
rb_define_method(cDir,"each", dir_each, 0);
rb_define_method(cDir,"rewind", dir_rewind, 0);
rb_define_method(cDir,"tell", dir_tell, 0);