diff options
author | Benjamin Sugars <bsugars@canoe.ca> | 2001-05-08 13:09:44 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-09 16:24:37 +0000 |
commit | 75effbe0883c73e5d0f7c9626142eb85d956f1d3 (patch) | |
tree | 3cec02b61fc6f27be150932c12cc84ec3eb1d0ec | |
parent | adbecb01df3e094756a9a55e471d75094daded2e (diff) | |
download | perl-75effbe0883c73e5d0f7c9626142eb85d956f1d3.tar.gz |
Test offset when reading from a PerlIO::Scalar
Message-ID: <Pine.LNX.4.21.0105081654140.1212-100000@marmot.rim.canoe.ca>
p4raw-id: //depot/perl@10053
-rw-r--r-- | ext/PerlIO/Scalar/Scalar.xs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/PerlIO/Scalar/Scalar.xs b/ext/PerlIO/Scalar/Scalar.xs index a4203bf308..e1e9349cd9 100644 --- a/ext/PerlIO/Scalar/Scalar.xs +++ b/ext/PerlIO/Scalar/Scalar.xs @@ -198,7 +198,10 @@ PerlIOScalar_get_cnt(PerlIO *f) if (PerlIOBase(f)->flags & PERLIO_F_CANREAD) { PerlIOScalar *s = PerlIOSelf(f,PerlIOScalar); - return SvCUR(s->var) - s->posn; + if (SvCUR(s->var) > s->posn) + return SvCUR(s->var) - s->posn; + else + return 0; } return 0; } |