[dm-devel] [PATCH 05/15] libmultipath: Fix POLLIN checks
Bart Van Assche
bart.vanassche at sandisk.com
Fri Oct 21 18:43:11 UTC 2016
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 <bart.vanassche at sandisk.com>
---
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
More information about the dm-devel
mailing list