summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2009-02-23 13:25:33 -0600
committerSteve Peters <steve@fisharerojo.org>2009-02-23 13:25:33 -0600
commit40596bc538f0e2be42b50d80f46887e76a4a3b33 (patch)
tree20387daaf96e70c27384538662ae7a0be4df8628 /perlio.c
parent86bddcbfaf2555223ec8fc596416d13d7a1a1118 (diff)
downloadperl-40596bc538f0e2be42b50d80f46887e76a4a3b33.tar.gz
fileno() was failing when passed a NULL. I'm guessing that we don't really need to increase the refcount on a NULL fd.
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/perlio.c b/perlio.c
index b935734e4c..0a086a8b4f 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3033,7 +3033,9 @@ PerlIOStdio_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags)
stdio = PerlSIO_fdopen(fd, PerlIO_modestr(o,mode));
set_this:
PerlIOSelf(f, PerlIOStdio)->stdio = stdio;
- PerlIOUnix_refcnt_inc(fileno(stdio));
+ if(stdio) {
+ PerlIOUnix_refcnt_inc(fileno(stdio));
+ }
}
return f;
}