X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doio.c;h=3bad8f343ba5e7787d10e6dedbf8c782e9fff9c6;hb=f8f79f57f467ffff4d31dc518ce3f6d2364090a0;hp=da9cd80c39d10e666b4f2bfd7aca41949878631f;hpb=3b6c1aba8481917ec21730e293e339a1c561e02c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/doio.c b/doio.c index da9cd80..3bad8f3 100644 --- a/doio.c +++ b/doio.c @@ -94,7 +94,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, /* Collect default raw/crlf info from the op */ if (PL_op && PL_op->op_type == OP_OPEN) { - /* set up disciplines */ + /* set up IO layers */ U8 flags = PL_op->op_private; in_raw = (flags & OPpOPEN_IN_RAW); in_crlf = (flags & OPpOPEN_IN_CRLF); @@ -212,7 +212,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, *--tend = '\0'; if (num_svs) { - /* New style explict name, type is just mode and discipline/layer info */ + /* New style explicit name, type is just mode and layer info */ STRLEN l = 0; #ifdef USE_STDIO if (SvROK(*svp) && !strchr(name,'&')) { @@ -236,7 +236,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, if ((*type == IoTYPE_RDWR) && /* scary */ (*(type+1) == IoTYPE_RDONLY || *(type+1) == IoTYPE_WRONLY) && ((!num_svs || (tend > type+1 && tend[-1] != IoTYPE_PIPE)))) { - TAINT_PROPER("open"); + TAINT_PROPER("open"); mode[1] = *type++; writing = 1; } @@ -244,7 +244,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, if (*type == IoTYPE_PIPE) { if (num_svs) { if (type[1] != IoTYPE_STD) { - unknown_desr: + unknown_open_mode: Perl_croak(aTHX_ "Unknown open() mode '%.*s'", (int)olen, oname); } type++; @@ -289,7 +289,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, } } } - } + } /* IoTYPE_PIPE */ else if (*type == IoTYPE_WRONLY) { TAINT_PROPER("open"); type++; @@ -422,7 +422,9 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } } /* !& */ - } + if (!fp && type && *type && *type != ':' && !isIDFIRST(*type)) + goto unknown_open_mode; + } /* IoTYPE_WRONLY */ else if (*type == IoTYPE_RDONLY) { /*SUPPRESS 530*/ for (type++; isSPACE(*type); type++) ; @@ -453,8 +455,11 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, } fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } - } - else if ((num_svs && type[0] == IoTYPE_STD && type[1] == IoTYPE_PIPE) || + if (!fp && type && *type && *type != ':' && !isIDFIRST(*type)) + goto unknown_open_mode; + } /* IoTYPE_RDONLY */ + else if ((num_svs && /* '-|...' or '...|' */ + type[0] == IoTYPE_STD && type[1] == IoTYPE_PIPE) || (!num_svs && tend > type+1 && tend[-1] == IoTYPE_PIPE)) { if (num_svs) { type += 2; /* skip over '-|' */ @@ -499,9 +504,9 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, } } } - else { + else { /* layer(Args) */ if (num_svs) - goto unknown_desr; + goto unknown_open_mode; name = type; IoTYPE(io) = IoTYPE_RDONLY; /*SUPPRESS 530*/ @@ -1165,7 +1170,7 @@ fail_discipline: if (!end) end = s+len; #ifndef PERLIO_LAYERS - Perl_croak(aTHX_ "Unknown discipline '%.*s'", end-s, s); + Perl_croak(aTHX_ "IO layers (like '%.*s') unavailable", end-s, s); #else s = end; #endif