summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-12 11:25:19 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-12 11:25:19 +0000
commit56c3d3d7f7f1b45cf341cc25dbc0fbde54dceab1 (patch)
tree56071fd7ace66ccc5463039a41d389727ef709db /perlio.c
parent579f9913bd0b54ec2474ba1d4322c32a64a3ee05 (diff)
downloadperl-56c3d3d7f7f1b45cf341cc25dbc0fbde54dceab1.tar.gz
Slightly amended version of the proposed patch for
"[perl #22390] export PERLIO=bytes segfaults"; the amendment is to set errno. TODO: we really should not get here if the layer stack is corrupt or non-sensical (like "bytes"). p4raw-id: //depot/perl@19747
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/perlio.c b/perlio.c
index 91db1e1856..38db370b62 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3421,8 +3421,10 @@ PerlIOBuf_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
* mode++;
*/
}
- f = (*tab->Open) (aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
- f, narg, args);
+ f = tab && tab->Open ?
+ (*tab->Open) (aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
+ f, narg, args)
+ : Nullfp;
if (f) {
if (PerlIO_push(aTHX_ f, self, mode, PerlIOArg) == 0) {
/*
@@ -3451,6 +3453,8 @@ PerlIOBuf_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
#endif
}
}
+ else
+ SETERRNO(EINVAL, SS_IVCHAN);
}
return f;
}