diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-21 12:56:27 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-21 12:56:27 +0000 |
commit | 52744f63cab71e4f408a2490707f42c331bb389e (patch) | |
tree | 50408b3cf1b0f159e3a9502255bd7f2e2b2f4559 /ext | |
parent | 9dd79c3f9b66ee5059b4277b6f15d5bfcd846510 (diff) | |
download | perl-52744f63cab71e4f408a2490707f42c331bb389e.tar.gz |
Warn and set errno when open(...,":encoding(xxxxx)",...) cannot find xxxxx.
p4raw-id: //depot/perlio@8497
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Encode/Encode.xs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index fce3ca430d..a4670cddf1 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -64,12 +64,21 @@ PerlIOEncode_pushed(PerlIO *f, const char *mode,const char *arg,STRLEN len) XPUSHs(sv_2mortal(newSVpvn(arg,len))); PUTBACK; if (perl_call_method("getEncoding",G_SCALAR) != 1) - return -1; + { + /* should never happen */ + Perl_die(aTHX_ "Encode::getEncoding did not return a value"); + return -1; + } SPAGAIN; e->enc = POPs; PUTBACK; if (!SvROK(e->enc)) - return -1; + { + e->enc = Nullsv; + errno = EINVAL; + Perl_warner(aTHX_ WARN_IO, "Cannot find encoding \"%.*s\"", (int) len, arg); + return -1; + } SvREFCNT_inc(e->enc); FREETMPS; LEAVE; |