summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-01-21 12:56:27 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-01-21 12:56:27 +0000
commit52744f63cab71e4f408a2490707f42c331bb389e (patch)
tree50408b3cf1b0f159e3a9502255bd7f2e2b2f4559 /ext
parent9dd79c3f9b66ee5059b4277b6f15d5bfcd846510 (diff)
downloadperl-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.xs13
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;