Instead of testing (pfd.revents == 0) & 1, test whether
(pfd.revents & 1) == 0.

This has been detected by the sparse static analyzer.

Signed-off-by: Bart Van Assche <[email protected]>
---
 libmpathcmd/mpath_cmd.c | 2 +-
 libmultipath/uxsock.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libmpathcmd/mpath_cmd.c b/libmpathcmd/mpath_cmd.c
index 667a2dc..d9c5790 100644
--- a/libmpathcmd/mpath_cmd.c
+++ b/libmpathcmd/mpath_cmd.c
@@ -31,7 +31,7 @@ static ssize_t read_all(int fd, void *buf, size_t len, 
unsigned int timeout)
                        if (errno == EINTR)
                                continue;
                        return -1;
-               } else if (!pfd.revents & POLLIN)
+               } else if (!(pfd.revents & POLLIN))
                        continue;
                n = recv(fd, buf, len, 0);
                if (n < 0) {
diff --git a/libmultipath/uxsock.c b/libmultipath/uxsock.c
index 880257f..b158a56 100644
--- a/libmultipath/uxsock.c
+++ b/libmultipath/uxsock.c
@@ -116,7 +116,7 @@ ssize_t read_all(int fd, void *buf, size_t len, unsigned 
int timeout)
                        if (errno == EINTR)
                                continue;
                        return -errno;
-               } else if (!pfd.revents & POLLIN)
+               } else if (!(pfd.revents & POLLIN))
                        continue;
                n = read(fd, buf, len);
                if (n < 0) {
-- 
2.10.1

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to