aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2016-06-16 22:46:02 +0300
committerLasse Collin <lasse.collin@tukaani.org>2016-06-28 21:11:02 +0300
commit1ddc479851139d6e8202e5835421bfe6578d9e07 (patch)
tree6c62e46ec03bf7889cf6c70b1404431eae904867
parentBuild: Fix = to += for xz_SOURCES in src/xz/Makefile.am. (diff)
downloadxz-1ddc479851139d6e8202e5835421bfe6578d9e07.tar.xz
xz: Silence warnings from -Wlogical-op.
Thanks to Evan Nemerson.
-rw-r--r--src/xz/file_io.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/xz/file_io.c b/src/xz/file_io.c
index 493dca8a..a8baa29d 100644
--- a/src/xz/file_io.c
+++ b/src/xz/file_io.c
@@ -37,6 +37,14 @@ static bool warn_fchown;
# define O_NOCTTY 0
#endif
+// Using this macro to silence a warning from gcc -Wlogical-op.
+#if EAGAIN == EWOULDBLOCK
+# define IS_EAGAIN_OR_EWOULDBLOCK(e) ((e) == EAGAIN)
+#else
+# define IS_EAGAIN_OR_EWOULDBLOCK(e) \
+ ((e) == EAGAIN || (e) == EWOULDBLOCK)
+#endif
+
typedef enum {
IO_WAIT_MORE, // Reading or writing is possible.
@@ -1017,7 +1025,7 @@ io_read(file_pair *pair, io_buf *buf_union, size_t size)
}
#ifndef TUKLIB_DOSLIKE
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ if (IS_EAGAIN_OR_EWOULDBLOCK(errno)) {
const io_wait_ret ret = io_wait(pair,
mytime_get_flush_timeout(),
true);
@@ -1105,7 +1113,7 @@ io_write_buf(file_pair *pair, const uint8_t *buf, size_t size)
}
#ifndef TUKLIB_DOSLIKE
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ if (IS_EAGAIN_OR_EWOULDBLOCK(errno)) {
if (io_wait(pair, -1, false) == IO_WAIT_MORE)
continue;