From: Benjamin Sugars Date: Wed, 9 May 2001 12:42:30 +0000 (-0400) Subject: Re: [PATCH] Test offset when reading from a PerlIO::Scalar X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb70fc7c36e397e79cee05db45026e1462029dd9;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] Test offset when reading from a PerlIO::Scalar Message-ID: p4raw-id: //depot/perl@10054 --- diff --git a/perlio.c b/perlio.c index 7580f2a..ba932f3 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);