Skip to contentSkip to conversation

master - gcc: logical-op warning go away

PATCH Zdenek Kabelac 1 participant 1 message Feb 23, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c0b836e316c20b8ed4325331cf33ef36815eb233
Commit:        c0b836e316c20b8ed4325331cf33ef36815eb233
Parent:        05cc1b87a952995c54ad99b8e9a0da9479bb56a5
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Feb 23 13:16:55 2016 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Feb 23 14:41:24 2016 +0100

gcc: logical-op warning go away

Don't be too much inventive and shutdown gcc6 warning:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602

---
 lib/device/dev-md.c          |    4 ++--
 libdaemon/client/daemon-io.c |   10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)
lib/device/dev-md.c +2 -2
index b6ee59f..3dbe831 100644
@@ -38,8 +38,8 @@ static int _dev_has_md_magic(struct device *dev, uint64_t sb_offset)
 
 	/* Version 1 is little endian; version 0.90.0 is machine endian */
 	if (dev_read(dev, sb_offset, sizeof(uint32_t), &md_magic) &&
-	    ((md_magic == xlate32(MD_SB_MAGIC)) ||
-	     (md_magic == MD_SB_MAGIC)))
+	    ((md_magic == MD_SB_MAGIC) ||
+	     ((MD_SB_MAGIC != xlate32(MD_SB_MAGIC)) && (md_magic == xlate32(MD_SB_MAGIC)))))
 		return 1;
 
 	return 0;
libdaemon/client/daemon-io.c +6 -4
index f072764..5419d40 100644
@@ -49,8 +49,9 @@ int buffer_read(int fd, struct buffer *buffer) {
 		} else if (result == 0) {
 			errno = ECONNRESET;
 			return 0; /* we should never encounter EOF here */
-		} else if (result < 0 && ( errno == EAGAIN || errno == EWOULDBLOCK ||
-					   errno == EINTR || errno == EIO)) {
+		} else if (result < 0 && (errno == EAGAIN ||
+					  (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK) ||
+					  errno == EINTR || errno == EIO)) {
 			fd_set in;
 			FD_ZERO(&in);
 			FD_SET(fd, &in);
@@ -78,8 +79,9 @@ int buffer_write(int fd, const struct buffer *buffer) {
 			result = write(fd, use->mem + written, use->used - written);
 			if (result > 0)
 				written += result;
-			else if (result < 0 && ( errno == EAGAIN || errno == EWOULDBLOCK ||
-						 errno == EINTR || errno == EIO)) {
+			else if (result < 0 && (errno == EAGAIN ||
+						(EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK) ||
+						errno == EINTR || errno == EIO)) {
 				fd_set out;
 				FD_ZERO(&out);
 				FD_SET(fd, &out);