On 17.01.2011, at 15:18, Davi Arnaut wrote:
> Hi Dmitry,
> On 1/12/11 2:13 PM, Dmitry Shulga wrote:
>> #At file:///Users/shulga/projects/mysql/5.1-bugteam-bug57450/ based on
>> 3521 Dmitry Shulga 2011-01-12
>> Fixed bug#57450 - mysql client enter in an infinite loop
>> if the standard input is a directory.
>> The problem is that mysql monitor try to read from stdin without
>> checking input source type.
>> The solution is to stop reading data from standard input if a call
>> to read(2) failed.
>> A new output parameter was introduced into functions batch_readline()
>> and intern_read_line() in order to differentiate between
>> cases of getting EOF and getting error on standard input.
> The error handling looks good so far, but I particularly don't like how the error and
> EOF states are being passed. I prefer the state (EOF and error) to be associated with the
> buffer. The attached patch implements this approach.
Your approach is good. I will implement and fix it.