summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-08-11 10:25:15 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-08-11 10:25:15 +0000
commite949e37c57a7b8894b837a34a436233508daf2e1 (patch)
tree66357da41da47fff5b42e22bcd65c5e22744a66d /perlio.c
parented423f7afb5038546a92d00ca689992f3e08bc61 (diff)
downloadperl-e949e37c57a7b8894b837a34a436233508daf2e1.tar.gz
Fix for [perl #15986] tell/seek misbehave for :crlf
Test from "Vadim Konovalov" <vkonovalov@peterstar.ru> fix by Nick I-S based on study of problem based on Vadim's analysis. p4raw-id: //depot/perlio@17709
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/perlio.c b/perlio.c
index 11f600fc5f..ea36d8027e 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3839,13 +3839,16 @@ PerlIOCrlf_get_cnt(pTHX_ PerlIO *f)
b->ptr++; /* say we have read it as far as
* flush() is concerned */
b->buf++; /* Leave space in front of buffer */
+ /* Note as we have moved buf up flush's
+ posn += ptr-buf
+ will naturally make posn point at CR
+ */
b->bufsiz--; /* Buffer is thus smaller */
code = PerlIO_fill(f); /* Fetch some more */
b->bufsiz++; /* Restore size for next time */
b->buf--; /* Point at space */
b->ptr = nl = b->buf; /* Which is what we hand
* off */
- b->posn--; /* Buffer starts here */
*nl = 0xd; /* Fill in the CR */
if (code == 0)
goto test; /* fill() call worked */