summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorGoro Fuji <gfuji@cpan.org>2008-07-07 17:04:52 +0900
committerSteve Peters <steve@fisharerojo.org>2008-11-08 05:18:16 +0000
commit2556f95e0f4f5e8e95c9766374614ab52edefe3d (patch)
tree40a448e6a8dd8a6660c7420454e769873ba482bd /perlio.c
parent5fae6dc1d23a9b59e9fc4a976e5c42f399ad3872 (diff)
downloadperl-2556f95e0f4f5e8e95c9766374614ab52edefe3d.tar.gz
Re: [perl #56644] PerlIO resource leaks on open() and then :pop in :unix and :stdio
From: "Goro Fuji" <gfuji@cpan.org> Message-ID: <efb9c59b0807061604q476025e9n85893f131a6bf23e@mail.gmail.com> p4raw-id: //depot/perl@34775
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/perlio.c b/perlio.c
index a3ea344620..436bb85a68 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2736,10 +2736,15 @@ PerlIOUnix_tell(pTHX_ PerlIO *f)
return PerlLIO_lseek(PerlIOSelf(f, PerlIOUnix)->fd, 0, SEEK_CUR);
}
-
IV
PerlIOUnix_close(pTHX_ PerlIO *f)
{
+ return PerlIOBase_noop_ok(aTHX_ f);
+}
+
+IV
+PerlIOUnix_popped(pTHX_ PerlIO *f)
+{
dVAR;
const int fd = PerlIOSelf(f, PerlIOUnix)->fd;
int code = 0;
@@ -2772,7 +2777,7 @@ PERLIO_FUNCS_DECL(PerlIO_unix) = {
sizeof(PerlIOUnix),
PERLIO_K_RAW,
PerlIOUnix_pushed,
- PerlIOBase_popped,
+ PerlIOUnix_popped,
PerlIOUnix_open,
PerlIOBase_binmode, /* binmode */
NULL,
@@ -3122,6 +3127,12 @@ PerlIOStdio_invalidate_fileno(pTHX_ FILE *f)
IV
PerlIOStdio_close(pTHX_ PerlIO *f)
{
+ return PerlIOBase_noop_ok(aTHX_ f);
+}
+
+IV
+PerlIOStdio_popped(pTHX_ PerlIO *f)
+{
FILE * const stdio = PerlIOSelf(f, PerlIOStdio)->stdio;
if (!stdio) {
errno = EBADF;
@@ -3558,7 +3569,7 @@ PERLIO_FUNCS_DECL(PerlIO_stdio) = {
sizeof(PerlIOStdio),
PERLIO_K_BUFFERED|PERLIO_K_RAW,
PerlIOStdio_pushed,
- PerlIOBase_popped,
+ PerlIOStdio_popped,
PerlIOStdio_open,
PerlIOBase_binmode, /* binmode */
NULL,