[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: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [Bug 1798780] [NEW] hw/usb/dev-mtp.c:1616: bad test ? |
Date: |
Fri, 18 Jan 2019 17:18:23 +0000 |
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
-- PMM
- Re: [Qemu-devel] [Bug 1798780] [NEW] hw/usb/dev-mtp.c:1616: bad test ?,
Peter Maydell <=