summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-03-24 10:29:37 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-03-24 10:29:37 +0000
commitf6c77cf1bf4d7cb2c7a64dd7608120b471f84062 (patch)
treef451c26b5e8e83030868fb6a14844822e66dfc8e /doio.c
parente3f3bf95bcb81efe35cb0f0d3e3528d5c002dcec (diff)
downloadperl-f6c77cf1bf4d7cb2c7a64dd7608120b471f84062.tar.gz
Implement:
1. open($fh,"+<",undef); # add test to t/io/open.t 2. open($fh,"+<",\$var); # New test t/lib/io_scalar.t p4raw-id: //depot/perlio@9318
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/doio.c b/doio.c
index 94e3826660..d980deaa37 100644
--- a/doio.c
+++ b/doio.c
@@ -211,7 +211,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
if (num_svs) {
/* New style explict name, type is just mode and discipline/layer info */
STRLEN l;
- name = SvPV(*svp, l) ;
+ name = SvOK(*svp) ? SvPV(*svp, l) : "";
len = (I32)l;
name = savepvn(name, len);
SAVEFREEPV(name);
@@ -512,7 +512,9 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
}
}
- if (IoTYPE(io) && IoTYPE(io) != IoTYPE_PIPE && IoTYPE(io) != IoTYPE_STD) {
+ if (IoTYPE(io) && IoTYPE(io) != IoTYPE_PIPE && IoTYPE(io) != IoTYPE_STD &&
+ /* FIXME: This next term is a hack to avoid fileno on PerlIO::Scalar */
+ !(num_svs && SvROK(*svp))) {
if (PerlLIO_fstat(PerlIO_fileno(fp),&PL_statbuf) < 0) {
(void)PerlIO_close(fp);
goto say_false;