On 07/16/13 20:57, Anthony Liguori wrote:
> Laszlo Ersek <ler...@redhat.com> writes:
> 
>> The g_io_channel_write_chars() documentation states,
>>
>>   bytes_written: The number of bytes written. This can be nonzero even if
>>                  the return value is not G_IO_STATUS_NORMAL. [...]
>>
>> io_channel_send() could lose such bytes before.
>>
>> Furthermore, the (status == G_IO_STATUS_EOF) condition used to evaluate to
>> constant false whenever it was reached. When that condition actually held,
>> it always led to -1 / EINVAL. This patch (almost) distinguishes
>> G_IO_STATUS_EOF only when no bytes have been written, and then treats it
>> as an error.
> 
> Just for my own benefit, I always assume G_IO_STATUS_EOF cannot happen
> if bytes_written > 0.  I see what you mean by the comment but do you
> have any reason to believe this happens in practice?

In my opinion, G_IO_STATUS_EOF doesn't make any sense whatsoever for a
write operation (for count>0) if glib kept any resemblance to write(),
and should never happen in practice.

The awkward commit message only captures the fact that I didn't forget
about G_IO_STATUS_EOF, I considered it explicitly.

> Reviewed-by: Anthony Liguori <aligu...@us.ibm.com>

Thanks!

Laszlo


Reply via email to