From: Nick Ing-Simmons Date: Sat, 7 Apr 2001 09:11:38 +0000 (+0000) Subject: Cleanup correction for failed :Via() layer, also set an error code. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=267cbce72d0da7af102852e6d7e0bb5c1ce41da6;p=p5sagit%2Fp5-mst-13.2.git Cleanup correction for failed :Via() layer, also set an error code. p4raw-id: //depot/perlio@9603 --- diff --git a/ext/PerlIO/Via/Via.xs b/ext/PerlIO/Via/Via.xs index 0abcece..cb3f328 100644 --- a/ext/PerlIO/Via/Via.xs +++ b/ext/PerlIO/Via/Via.xs @@ -126,7 +126,7 @@ PerlIOVia_pushed(PerlIO *f, const char *mode, SV *arg) { STRLEN pkglen = 0; char *pkg = SvPV(arg,pkglen); - s->obj = arg; + s->obj = SvREFCNT_inc(arg); s->stash = gv_stashpvn(pkg, pkglen, FALSE); if (s->stash) { @@ -135,7 +135,10 @@ PerlIOVia_pushed(PerlIO *f, const char *mode, SV *arg) if (result) { if (sv_isobject(result)) - s->obj = SvREFCNT_inc(result); + { + s->obj = SvREFCNT_inc(result); + SvREFCNT_dec(arg); + } else if (SvIV(result) != 0) return SvIV(result); } @@ -147,6 +150,13 @@ PerlIOVia_pushed(PerlIO *f, const char *mode, SV *arg) else { Perl_warn(aTHX_ "Cannot find package '%.*s'",(int) pkglen,pkg); +#ifdef ENOSYS + errno = ENOSYS; +#else +#ifdef ENOENT + errno = ENOENT; +#endif +#endif code = -1; } }