mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 19:18:09 +02:00
_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 <dking@redhat.com>
Reviewed-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a653191342)
This commit is contained in:
parent
2fb62561f0
commit
c6c6b423cf
1 changed files with 8 additions and 0 deletions
|
|
@ -4364,7 +4364,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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue