platform: refactor check for error in event_handler_recvmsgs() to switch statement

This commit is contained in:
Thomas Haller
2016-01-25 15:07:10 +01:00
parent 8ab968d4ef
commit 4ba999e41e

View File

@@ -5530,12 +5530,16 @@ continue_reading:
errno = 0; errno = 0;
n = nl_recv (sk, &nla, &buf, &creds); n = nl_recv (sk, &nla, &buf, &creds);
/* Work around a libnl bug fixed in 3.2.22 (375a6294) */ switch (n) {
if (n == 0 && errno == EAGAIN) { case 0:
/* EAGAIN is equal to EWOULDBLOCK. If it would not be, we'd have to /* Work around a libnl bug fixed in 3.2.22 (375a6294) */
* workaround libnl3 mapping EWOULDBLOCK to -NLE_FAILURE. */ if (errno == EAGAIN) {
G_STATIC_ASSERT (EAGAIN == EWOULDBLOCK); /* EAGAIN is equal to EWOULDBLOCK. If it would not be, we'd have to
n = -NLE_AGAIN; * workaround libnl3 mapping EWOULDBLOCK to -NLE_FAILURE. */
G_STATIC_ASSERT (EAGAIN == EWOULDBLOCK);
n = -NLE_AGAIN;
}
break;
} }
if (n <= 0) if (n <= 0)