Re: [PATCH] bash: fix error path of getc_with_restart()

2013-10-29 Thread Chet Ramey
On 10/28/13, 10:51 PM, Yong Zhang wrote: > When read() returns with ERROR, local_bufused will be set > to -1; and if we return with local_bufused == -1 left, > the next time we call getc_with_restart(), the condition > (local_index == local_bufused || local_bufused == 0) > will not match, thus we g

[PATCH] bash: fix error path of getc_with_restart()

2013-10-28 Thread Yong Zhang
When read() returns with ERROR, local_bufused will be set to -1; and if we return with local_bufused == -1 left, the next time we call getc_with_restart(), the condition (local_index == local_bufused || local_bufused == 0) will not match, thus we get random data from localbuf[] with local_index inc