/* 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;
} 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);
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);