shared/util.c: In function ‘read_str_safe’:
shared/util.c:211:24: warning: logical ‘or’ of equal expressions [-Wlogical-op]
if (errno == EAGAIN || errno == EWOULDBLOCK ||
^~
shared/util.c: In function ‘write_str_safe’:
shared/util.c:237:24: warning: logical ‘or’ of equal expressions [-Wlogical-op]
if (errno == EAGAIN || errno == EWOULDBLOCK ||
^~
This is because EAGAIN and EWOULDBLOCK have the same value. Prefer
EAGAIN, but add a static assert to catch if it's not the same in another
architecture.
{ }
};
+assert_cc(EAGAIN == EWOULDBLOCK);
+
/* string handling functions and memory allocations */
/* ************************************************************************ */
todo -= r;
done += r;
} else {
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINTR)
+ if (errno == EAGAIN || errno == EINTR)
continue;
else
return -errno;
todo -= r;
done += r;
} else {
- if (errno == EAGAIN || errno == EWOULDBLOCK ||
- errno == EINTR)
+ if (errno == EAGAIN || errno == EINTR)
continue;
else
return -errno;
int r = read(fd, buf + done, sizeof(buf) - 1 - done);
if (r == 0)
break;
- if (r == -EWOULDBLOCK || r == -EAGAIN)
+ if (r == -EAGAIN)
continue;
done += r;