summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--dir.c14
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8fef803e9d..6e96dab06b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Nov 11 09:41:01 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (rb_push_glob): Dir.glob should have call its block.
+
Thu Nov 11 01:52:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (syserr_initialize): use stringified object.
diff --git a/dir.c b/dir.c
index 5c7f1cc5db..f0b1f00f23 100644
--- a/dir.c
+++ b/dir.c
@@ -939,18 +939,18 @@ glob_helper(pv, sub, flags, func, arg)
p = sub ? sub : path;
if (!has_magic(p, 0, flags)) {
#if defined DOSISH
- remove_backslashes(RSTRING(path)->ptr);
+ remove_backslashes(path);
#else
if (!(flags & FNM_NOESCAPE)) remove_backslashes(p);
#endif
- if (lstat(RSTRING(path)->ptr, &st) == 0) {
- status = glob_call_func(func, path, arg);
+ if (lstat(path, &st) == 0) {
+ status = glob_call_func(func, pv, arg);
if (status) return status;
}
else if (errno != ENOENT) {
/* In case stat error is other than ENOENT and
we may want to know what is wrong. */
- rb_sys_warning(RSTRING(path)->ptr);
+ rb_sys_warning(path);
}
return 0;
}
@@ -1119,7 +1119,7 @@ rb_glob(path, func, arg)
args.func = func;
args.arg = arg;
- status = rb_glob2(rb_str_new2(path), 0, func, &args);
+ status = rb_glob2(rb_str_new2(path), 0, rb_glob_caller, &args);
if (status) rb_jump_tag(status);
}
@@ -1254,6 +1254,10 @@ rb_push_glob(str, flags)
/* else unmatched braces */
}
if (status) rb_jump_tag(status);
+ if (rb_block_given_p()) {
+ rb_ary_each(ary);
+ return Qnil;
+ }
return ary;
}