summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-06-07 12:07:11 +0200
committerRafael Garcia-Suarez <rgs@consttype.org>2010-06-07 12:07:11 +0200
commit4984aa345cae6d92b88b5afcf09ce72cb121191a (patch)
treeaf0358c0adf0eecfe5958eccb6c65e0bba0c0125 /op.c
parentb3fe9f3f93e825d0b858b198dad1d2da4b7b4a95 (diff)
downloadperl-4984aa345cae6d92b88b5afcf09ce72cb121191a.tar.gz
glob crashes when %File::Glob:: is empty
In 5.6.2, a failure to find a CORE::GLOBAL::glob after loading File::Glob would result in a fallback to external glob via pp_glob. Now it crashes. The attached patch should fix this.
Diffstat (limited to 'op.c')
-rw-r--r--op.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/op.c b/op.c
index f66716421c..c50111c794 100644
--- a/op.c
+++ b/op.c
@@ -7167,11 +7167,12 @@ Perl_ck_glob(pTHX_ OP *o)
ENTER;
Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,
newSVpvs("File::Glob"), NULL, NULL, NULL);
- gv = gv_fetchpvs("CORE::GLOBAL::glob", 0, SVt_PVCV);
- glob_gv = gv_fetchpvs("File::Glob::csh_glob", 0, SVt_PVCV);
- GvCV(gv) = GvCV(glob_gv);
- SvREFCNT_inc_void(MUTABLE_SV(GvCV(gv)));
- GvIMPORTED_CV_on(gv);
+ if((glob_gv = gv_fetchpvs("File::Glob::csh_glob", 0, SVt_PVCV))) {
+ gv = gv_fetchpvs("CORE::GLOBAL::glob", 0, SVt_PVCV);
+ GvCV(gv) = GvCV(glob_gv);
+ SvREFCNT_inc_void(MUTABLE_SV(GvCV(gv)));
+ GvIMPORTED_CV_on(gv);
+ }
LEAVE;
}
#endif /* PERL_EXTERNAL_GLOB */