aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-03 02:14:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-03 02:14:51 +0000
commitfdd2f6f2ac8af873a128f71520b51c9ed1f23053 (patch)
tree6333fe4b82ca513d3c33aebf183aec5086b5cef0 /dir.c
parent0f571ba42760372f533d2d809653745edf826bde (diff)
downloadruby-fdd2f6f2ac8af873a128f71520b51c9ed1f23053.tar.gz
dir.c: relax base option
* dir.c (dir_glob_options): relax base option. ignore when nil or an empty string as :base option. [Feature #13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 017f715080..c02c071b97 100644
--- a/dir.c
+++ b/dir.c
@@ -2466,7 +2466,7 @@ dir_glob_options(VALUE opt, VALUE *base, int *flags)
kw[0] = rb_intern("base");
if (flags) kw[1] = rb_intern("flags");
rb_get_kwargs(opt, kw, 0, flags ? 2 : 1, args);
- if (args[0] == Qundef) {
+ if (args[0] == Qundef || NIL_P(args[0])) {
*base = Qnil;
}
#if USE_OPENDIR_AT
@@ -2476,6 +2476,7 @@ dir_glob_options(VALUE opt, VALUE *base, int *flags)
#endif
else {
GlobPathValue(args[0], TRUE);
+ if (!RSTRING_LEN(args[0])) args[0] = Qnil;
*base = args[0];
}
if (flags && args[1] != Qundef) {