diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-07-28 00:42:04 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-07-28 00:42:04 +0000 |
commit | ad02613cb6d8974aab9c68839c06129c8510c983 (patch) | |
tree | eb381b025d3dc17e6600391647454edd33353d7c /pp_sys.c | |
parent | cccd58310685ffd16595b2773caa8f1346d6b0ee (diff) | |
download | perl-ad02613cb6d8974aab9c68839c06129c8510c983.tar.gz |
Change stat() and -X filetests so that they treat *FILE{IO}
filehandles like *FILE filehandles. This resolves RT #8244.
p4raw-id: //depot/perl@28628
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -2781,6 +2781,7 @@ PP(pp_stat) dVAR; dSP; GV *gv; + IO *io; I32 gimme; I32 max = 13; @@ -2802,7 +2803,8 @@ PP(pp_stat) PL_statgv = gv; sv_setpvn(PL_statname, "", 0); if(gv) { - IO* const io = GvIO(gv); + io = GvIO(gv); + do_fstat_have_io: if (io) { if (IoIFP(io)) { PL_laststatval = @@ -2832,13 +2834,18 @@ PP(pp_stat) if (SvTYPE(sv) == SVt_PVGV) { gv = (GV*)sv; goto do_fstat; - } - else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVGV) { - gv = (GV*)SvRV(sv); - if (PL_op->op_type == OP_LSTAT) - goto do_fstat_warning_check; - goto do_fstat; - } + } else if(SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVGV) { + gv = (GV*)SvRV(sv); + if (PL_op->op_type == OP_LSTAT) + goto do_fstat_warning_check; + goto do_fstat; + } else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVIO) { + io = (IO*)SvRV(sv); + if (PL_op->op_type == OP_LSTAT) + goto do_fstat_warning_check; + goto do_fstat_have_io; + } + sv_setpv(PL_statname, SvPV_nolen_const(sv)); PL_statgv = NULL; PL_laststype = PL_op->op_type; |