Peter Maydell <peter.mayd...@linaro.org> writes:

> On Fri, 19 Oct 2018 at 10:22, dcb <1798...@bugs.launchpad.net> wrote:
>> hw/usb/dev-mtp.c:1616:52: warning: logical ‘or’ of collectively
>> exhaustive tests is always true [-Wlogical-op]
>>
>> Source code is
>>
>>                 if ((ret == -1) && (errno != EINTR || errno != EAGAIN ||
>>                                     errno != EWOULDBLOCK)) {
>>
>> Maybe better code
>>
>>                 if ((ret == -1) && (errno != EINTR && errno != EAGAIN &&
>>                                     errno != EWOULDBLOCK)) {
>
> Hi Gerd, Bandan -- I was going through older launchpad bugs and
> noticed that this one about a dubious conditional in dev-mtp.c is
> still unfixed.
>
> Is the file descriptor being used here one that's in non-blocking
> mode? If so, then busy-waiting in a loop while the write() returns
> EWOULDBLOCK is probably not what you wanted. If it's not then
> there's no need to check for EAGAIN or EWOULDBLOCK, I think.
> Consider using qemu_write_full() instead of open-coding
> the retry loop ?
>

Thanks for the suggestion, Peter. I agree, this isn't
non-blocking and qemu_write_full() can be used. Following up
with a patch.

Bandan

> thanks
> -- PMM

Reply via email to