qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] char: io_channel_send: don't lose written b


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH 1/2] char: io_channel_send: don't lose written bytes
Date: Tue, 16 Jul 2013 21:26:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130621 Thunderbird/17.0.7

On 07/16/13 20:57, Anthony Liguori wrote:
> Laszlo Ersek <address@hidden> 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 <address@hidden>

Thanks!

Laszlo




reply via email to

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