summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2002-08-05 22:35:22 +0000
committerhv <hv@crypt.org>2002-08-05 22:35:22 +0000
commitcc5470e2b2d9deadc4c9495a355863bbf6999707 (patch)
treea5114ab08535c53970cb3ac17b3c077b0b05ee04
parente55ac0fa2de97f387f14e72ecb12931a1e26d2c6 (diff)
parentabc0a0153433fe6596e1ca3a6b5572dc424d0f11 (diff)
downloadperl-cc5470e2b2d9deadc4c9495a355863bbf6999707.tar.gz
Integrate from perlio: change #17653 fixes bug RT15283
p4raw-link: @17653 on //depot/perlio: abc0a0153433fe6596e1ca3a6b5572dc424d0f11 p4raw-id: //depot/perl@17684
-rw-r--r--ext/PerlIO/via/via.xs14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/PerlIO/via/via.xs b/ext/PerlIO/via/via.xs
index 0c247780b6..2bcd35562d 100644
--- a/ext/PerlIO/via/via.xs
+++ b/ext/PerlIO/via/via.xs
@@ -143,11 +143,15 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg,
s->stash = gv_stashpvn(SvPVX(s->obj), pkglen + 13, FALSE);
}
if (s->stash) {
- SV *modesv =
- (mode) ? sv_2mortal(newSVpvn(mode, strlen(mode))) :
- Nullsv;
- SV *result =
- PerlIOVia_method(aTHX_ f, MYMethod(PUSHED), G_SCALAR,
+ char lmode[8];
+ SV *modesv;
+ SV *result;
+ if (!mode) {
+ /* binmode() passes NULL - so find out what mode is */
+ mode = PerlIO_modestr(f,lmode);
+ }
+ modesv = sv_2mortal(newSVpvn(mode, strlen(mode)));
+ result = PerlIOVia_method(aTHX_ f, MYMethod(PUSHED), G_SCALAR,
modesv, Nullsv);
if (result) {
if (sv_isobject(result)) {