summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-07-23 07:56:25 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-07-23 07:56:25 +0000
commitabc0a0153433fe6596e1ca3a6b5572dc424d0f11 (patch)
tree85b29207ce94d1fa60e6551d1bc6aae410b97504 /ext
parenta29bb5d65184e75403dfd9e067748a8e99d945b7 (diff)
downloadperl-abc0a0153433fe6596e1ca3a6b5572dc424d0f11.tar.gz
Fix #15283 - binmode() was not passing mode
to PUSHED method called from PerlIO::via. p4raw-id: //depot/perlio@17653
Diffstat (limited to 'ext')
-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)) {