diff options
author | Thomas Haller <thaller@redhat.com> | 2018-03-09 17:44:17 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-03-09 17:44:17 +0100 |
commit | bc0bcc924d80cf8390ff58eff9dee3a6e93f86a8 (patch) | |
tree | c6a60e40699780a0650104c6246d16d8c0e2a4f3 | |
parent | d9a06042eb553acbecfcb51ab27180b9f02ece95 (diff) | |
download | NetworkManager-bg/extack-bgo793261.tar.gz |
platform: pre-increment netlink sequence number and add commentbg/extack-bgo793261
Pre-increment. That allows to not explicitly initialize nlh_seq_next
in nm_linux_platform_init().
-rw-r--r-- | src/platform/nm-linux-platform.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 425e610573..f29ee03e6a 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3964,8 +3964,10 @@ cache_on_change (NMPlatform *platform, static guint32 _nlh_seq_next_get (NMLinuxPlatformPrivate *priv) { - /* generate a new sequence number, but skip zero. */ - return priv->nlh_seq_next++ ?: priv->nlh_seq_next++; + /* generate a new sequence number, but never return zero. + * Wrapping numbers are not a problem, because we don't rely + * on strictly increasing sequence numbers. */ + return (++priv->nlh_seq_next) ?: (++priv->nlh_seq_next); } /** @@ -6932,7 +6934,6 @@ nm_linux_platform_init (NMLinuxPlatform *self) { NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (self); - priv->nlh_seq_next = 1; priv->delayed_action.list_master_connected = g_ptr_array_new (); priv->delayed_action.list_refresh_link = g_ptr_array_new (); priv->delayed_action.list_wait_for_nl_response = g_array_new (FALSE, TRUE, sizeof (DelayedActionWaitForNlResponseData)); |