diff mbox

[05/15] libmultipath: Fix POLLIN checks

Message ID 4abc7f19-0f90-6928-09ef-1379e25debe7@sandisk.com (mailing list archive)
State Not Applicable, archived
Delegated to: Mike Snitzer
Headers show

Commit Message

Bart Van Assche Oct. 21, 2016, 6:43 p.m. UTC
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@sandisk.com>
---
 libmpathcmd/mpath_cmd.c | 2 +-
 libmultipath/uxsock.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

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) {