hw/usb/dev-mtp.c:1616: bad test ?
Bug #1798780 reported by
dcb
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
hw/usb/
Source code is
if ((ret == -1) && (errno != EINTR || errno != EAGAIN ||
Maybe better code
if ((ret == -1) && (errno != EINTR && errno != EAGAIN &&
Changed in qemu: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
On Fri, 19 Oct 2018 at 10:22, dcb <email address hidden> wrote: dev-mtp. c:1616: 52: warning: logical ‘or’ of collectively
> hw/usb/
> 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