]> sourceware.org Git - lvm2.git/commitdiff
gcc: logical-op warning go away
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 23 Feb 2016 12:16:55 +0000 (13:16 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 23 Feb 2016 13:41:24 +0000 (14:41 +0100)
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
libdaemon/client/daemon-io.c

index b6ee59fc01713edaa334097685c7c466949c27bd..3dbe831ca26f78162b6096706d5c40058d886818 100644 (file)
@@ -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;
index f072764a7d07d877f54a18f78374d4f031330bc8..5419d40530639ccd0ae228f389546605b1fdeac1 100644 (file)
@@ -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);
This page took 0.038372 seconds and 5 git commands to generate.