develooper Front page | perl.perl5.porters | Postings from April 2008

Re: bug in if(open(my $fh,...))

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
April 29, 2008 04:59
Subject:
Re: bug in if(open(my $fh,...))
Message ID:
20080429115815.10473.qmail@lists.develooper.com
Matt Sergeant schreef:

> perl -Mstrict -le 'if (1) { if (open(my $fh, q(/etc/passwd))) { print
> "inner"; } } system(qq(ls -l /proc/$$/fd));'
>
> Shows that the filehandle just isn't closed AT ALL (until program
> exit).

That's another bug. The "if (1) {}" can be optimized away, but should at
least leave a (scoping) block.

-- 
Affijn, Ruud

"Gewoon is een tijger."


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About