From: David King Date: Fri, 12 Oct 2018 15:20:39 +0000 (+0100) Subject: _dbus_get_is_errno_eagain_or_ewouldblock: Avoid warning X-Git-Tag: dbus-1.13.8~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a65319134209d39f5eb6e5425ec6a35fad05bcd7;p=thirdparty%2Fdbus.git _dbus_get_is_errno_eagain_or_ewouldblock: Avoid warning EAGAIN and EWOULDBLOCK are documented to possibly be numerically equal, for instance in errno(3), and a simple logical OR check will trigger the -Wlogical-op warning of GCC. The GCC developers consider the warning to work as-designed in this case: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602 Avoid such a warning by explicitly checking if the values are identical. Fixes: https://gitlab.freedesktop.org/dbus/dbus/issues/225 Signed-off-by: David King Reviewed-by: Simon McVittie --- diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 1b2033731..2b1c60691 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -4604,7 +4604,15 @@ _dbus_daemon_unpublish_session_bus_address (void) dbus_bool_t _dbus_get_is_errno_eagain_or_ewouldblock (int e) { + /* Avoid the -Wlogical-op GCC warning, which can be triggered when EAGAIN and + * EWOULDBLOCK are numerically equal, which is permitted as described by + * errno(3). + */ +#if EAGAIN == EWOULDBLOCK + return e == EAGAIN; +#else return e == EAGAIN || e == EWOULDBLOCK; +#endif } /**