mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-01 14:58:05 +02:00
platform: cleanup event_handler_recvmsg() (move EAGAIN workaround)
This commit is contained in:
parent
bdd2c31d39
commit
c13163cd55
1 changed files with 9 additions and 9 deletions
|
|
@ -5415,8 +5415,17 @@ event_handler_recvmsgs (NMPlatform *platform)
|
|||
struct ucred *creds = NULL;
|
||||
|
||||
continue_reading:
|
||||
errno = 0;
|
||||
n = nl_recv (sk, &nla, &buf, &creds);
|
||||
|
||||
/* Work around a libnl bug fixed in 3.2.22 (375a6294) */
|
||||
if (n == 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);
|
||||
n = -NLE_AGAIN;
|
||||
}
|
||||
|
||||
if (n <= 0)
|
||||
return n;
|
||||
|
||||
|
|
@ -5542,17 +5551,8 @@ event_handler_read_netlink_one (NMPlatform *platform)
|
|||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||
int nle;
|
||||
|
||||
errno = 0;
|
||||
nle = event_handler_recvmsgs (platform);
|
||||
|
||||
/* Work around a libnl bug fixed in 3.2.22 (375a6294) */
|
||||
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) {
|
||||
case -NLE_AGAIN:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue