From: Jarkko Hietaniemi Date: Thu, 12 Jun 2003 11:25:19 +0000 (+0000) Subject: Slightly amended version of the proposed patch for X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=56c3d3d7f7f1b45cf341cc25dbc0fbde54dceab1;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/perlio.c b/perlio.c index 91db1e1..38db370 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; }