summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2008-06-17 16:50:57 +0000
committerSteve Hay <SteveHay@planit.com>2008-06-17 16:50:57 +0000
commit799361c3c96b8b5eb1dd262f6945e07624ac881f (patch)
tree9171647888dc196826bde14d4565e725167acfec /toke.c
parentcba5fa5d0a628e83dc21e7421428994b2d09c88e (diff)
downloadperl-799361c3c96b8b5eb1dd262f6945e07624ac881f.tar.gz
Make sure parser's filehandle is closed when finished
(It was mistakenly left open if there was no old_parser, which caused t/comp/require.t to leave behind a 'bleah.pm' (from the test for #49472) on Win32, where the deletion of an open file fails.) p4raw-id: //depot/perl@34071
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index a601c51da8..e98e47c4c7 100644
--- a/toke.c
+++ b/toke.c
@@ -761,8 +761,8 @@ Perl_parser_free(pTHX_ const yy_parser *parser)
if (parser->rsfp == PerlIO_stdin())
PerlIO_clearerr(parser->rsfp);
- else if (parser->rsfp && parser->old_parser
- && parser->rsfp != parser->old_parser->rsfp)
+ else if (parser->rsfp && (!parser->old_parser ||
+ (parser->old_parser && parser->rsfp != parser->old_parser->rsfp)))
PerlIO_close(parser->rsfp);
SvREFCNT_dec(parser->rsfp_filters);