The value EAGAIN is allowed by POSIX to be the same as EWOULDBLOCK, but this is not guaranteed. Thus on some systems (e.g. glibc Linux), we get a warning that the logical OR is being performed on two expressions of the same type. We can not get rid of this test in case any system defines these as unique values. Use a pragma block to prevent any gcc warning on these tests. Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/util.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 4a4847d..e105786 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -476,7 +476,11 @@ static int _alpm_chroot_write_to_child(alpm_handle_t *handle, int fd, /* write was successful, remove the written data from the buffer */ *buf_size -= nwrite; memmove(buf, buf + nwrite, *buf_size); + +/* EAGAIN may be the same value as EWOULDBLOCK (POSIX.1) - prevent GCC warning */ +#pragma GCC diagnostic ignored "-Wlogical-op" } else if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { +#pragma GCC diagnostic pop /* nothing written, try again later */ } else { _alpm_log(handle, ALPM_LOG_ERROR, @@ -530,7 +534,11 @@ static int _alpm_chroot_read_from_child(alpm_handle_t *handle, int fd, _alpm_chroot_process_output(handle, buf); } return -1; + +/* EAGAIN may be the same value as EWOULDBLOCK (POSIX.1) - prevent GCC warning */ +#pragma GCC diagnostic ignored "-Wlogical-op" } else if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { +#pragma GCC diagnostic pop /* nothing read, try again */ } else { /* read error */ -- 2.8.2