diff options
author | Spider Boardman <spider@orb.nashua.nh.us> | 2001-06-19 11:33:25 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-19 19:03:07 +0000 |
commit | 601f2d16e592dad4a4b6a344fbe935aa06230d2e (patch) | |
tree | b500d8f3bec9347ac0ab84287841e0d7c46c20d0 /perlio.c | |
parent | 47af93600f5196082b45ca5744631cd71ddc84b3 (diff) | |
download | perl-601f2d16e592dad4a4b6a344fbe935aa06230d2e.tar.gz |
[ID 20010619.007] Not OK: perl v5.7.1 +DEVEL10721 +devel-10722 on alpha-dec_osf-perlio 4.0f (UNINSTALLED)
Message-Id: <200106191933.PAA08415@Orb.Nashua.NH.US>
p4raw-id: //depot/perl@10730
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -2800,17 +2800,24 @@ PerlIOBuf_unread(PerlIO *f, const void *vbuf, Size_t count) if (PerlIOBase(f)->flags & PERLIO_F_RDBUF) { avail = (b->ptr - b->buf); + if (avail > (SSize_t) count) + avail = count; } else { avail = b->bufsiz; + /* Adjust this here to keep a subsequent tell() correct. + * (b->ptr - b->buf) *MUST* be an accurate reflection of the amount + * unread in this buffer. (See previous part of the if for an example, + * or try PERLIO=unix on t/io/tell.t.) + */ + if (avail > (SSize_t) count) + avail = count; b->end = b->buf + avail; b->ptr = b->end; PerlIOBase(f)->flags |= PERLIO_F_RDBUF; - b->posn -= b->bufsiz; + b->posn -= avail; } - if (avail > (SSize_t) count) - avail = count; if (avail > 0) { b->ptr -= avail; |