summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-12-10 17:32:39 +0100
committerThomas Haller <thaller@redhat.com>2015-12-10 17:53:04 +0100
commitd2fab2df54183e065e8925abb270e14cb7a69b9c (patch)
treec39901aec9c1ebce40331c7a32d0add756cffc46
parent7235283a9a834f04b5f0856f2aa86e5654827b6d (diff)
downloadNetworkManager-d2fab2df54183e065e8925abb270e14cb7a69b9c.tar.gz
platform: EAGAIN is equal to EWOULDBLOCK
The macro EWOULDBLOCK is another name for EAGAIN; they are always the same in the GNU C Library. https://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Error-Codes.html Otherwise, we would need a workaround for EWOULDBLOCK too, because libnl maps that to NLE_FAILURE. So we would have to detect EAGAIN as (nle == -NLE_FAILURE && errno == EWOULDBLOCK).
-rw-r--r--src/platform/nm-linux-platform.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 3cceff79c7..e3cc4d4148 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -5456,8 +5456,12 @@ event_handler_read_netlink_one (NMPlatform *platform)
nle = nl_recvmsgs_default (priv->nlh_event);
/* Work around a libnl bug fixed in 3.2.22 (375a6294) */
- if (nle == 0 && (errno == EAGAIN || errno == EWOULDBLOCK))
+ if (nle == 0 && errno == EAGAIN) {
+ /* EAGAIN is equal to EWOULDBLOCK. If it would not be, we'd have to
+ * workaround libnl3 mapping EWOULDBLOCK to -NLE_FAILURE. */
+ G_STATIC_ASSERT (EAGAIN == EWOULDBLOCK);
nle = -NLE_AGAIN;
+ }
if (nle < 0)
switch (nle) {