summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorBenjamin Sugars <bsugars@canoe.ca>2001-05-09 08:42:30 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-09 16:25:42 +0000
commitfb70fc7c36e397e79cee05db45026e1462029dd9 (patch)
tree72b2ebdaee25a4d08fd4962289a002350f279146 /perlio.c
parent75effbe0883c73e5d0f7c9626142eb85d956f1d3 (diff)
downloadperl-fb70fc7c36e397e79cee05db45026e1462029dd9.tar.gz
Re: [PATCH] Test offset when reading from a PerlIO::Scalar
Message-ID: <Pine.LNX.4.21.0105091230110.1516-100000@marmot.rim.canoe.ca> p4raw-id: //depot/perl@10054
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/perlio.c b/perlio.c
index 7580f2a013..ba932f3d69 100644
--- a/perlio.c
+++ b/perlio.c
@@ -1646,7 +1646,9 @@ PerlIOBase_read(PerlIO *f, void *vbuf, Size_t count)
while (count > 0)
{
SSize_t avail = PerlIO_get_cnt(f);
- SSize_t take = (count < avail) ? count : avail;
+ SSize_t take = 0;
+ if (avail > 0)
+ take = (count < avail) ? count : avail;
if (take > 0)
{
STDCHAR *ptr = PerlIO_get_ptr(f);