[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Bug 1798780] [NEW] hw/usb/dev-mtp.c:1616: bad test ?
From: |
Bandan Das |
Subject: |
Re: [Qemu-devel] [Bug 1798780] [NEW] hw/usb/dev-mtp.c:1616: bad test ? |
Date: |
Tue, 22 Jan 2019 07:38:43 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Peter Maydell <address@hidden> writes:
> On Fri, 19 Oct 2018 at 10:22, dcb <address@hidden> 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