bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: incorrect lseek() when processing script ending in unterminated line


From: Stephane Chazelas
Subject: Re: incorrect lseek() when processing script ending in unterminated line
Date: Wed, 21 Dec 2016 14:41:08 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

2016-12-21 14:35:44 +0000, Stephane Chazelas:
[...]
> That sync_buffered_stream is meant to seek back to where we're
> meant to resume reading the script when we've read more than
> needed, but here b_inputp > b_used would suggest we've processed
> code that is passed what we've read. Or more likely b_used has
> incorrectly been set to 0.
[...]

Looks like it should only be a matter of:

diff --git a/input.c b/input.c
index 308b87e4..a03911d3 100644
--- a/input.c
+++ b/input.c
@@ -504,7 +504,7 @@ b_fill_buffer (bp)
     nr = zread (bp->b_fd, bp->b_buffer, bp->b_size);
   if (nr <= 0)
     {
-      bp->b_used = 0;
+      bp->b_used = bp->b_inputp = 0;
       bp->b_buffer[0] = 0;
       if (nr == 0)
        bp->b_flag |= B_EOF;

Though I've not done any testing other than it fixes that
particular problem.

-- 
Stephane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]