From: Steve Hay Date: Tue, 17 Jun 2008 16:50:57 +0000 (+0000) Subject: Make sure parser's filehandle is closed when finished X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=799361c3c96b8b5eb1dd262f6945e07624ac881f;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/toke.c b/toke.c index a601c51..e98e47c 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);