mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 13:38:43 +02:00
device: cleanup converting mtu to string for sysctl_set()
Use %u for unsigned type and cast the guint32 to (unsigned). While at it, increase the stack-allocated buffer to 64 bytes (it doesn't hurt) and use nm_sprintf_buf().
This commit is contained in:
parent
334a8a54be
commit
85c38d18a0
1 changed files with 4 additions and 3 deletions
|
|
@ -6636,7 +6636,6 @@ nm_device_ipv6_set_mtu (NMDevice *self, guint32 mtu)
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||||
guint32 ip_mtu = get_ip_mtu (self);
|
guint32 ip_mtu = get_ip_mtu (self);
|
||||||
guint32 plat_mtu = nm_device_ipv6_sysctl_get_int32 (self, "mtu", ip_mtu);
|
guint32 plat_mtu = nm_device_ipv6_sysctl_get_int32 (self, "mtu", ip_mtu);
|
||||||
char val[16];
|
|
||||||
|
|
||||||
priv->ip6_mtu = mtu ?: plat_mtu;
|
priv->ip6_mtu = mtu ?: plat_mtu;
|
||||||
|
|
||||||
|
|
@ -6659,8 +6658,10 @@ nm_device_ipv6_set_mtu (NMDevice *self, guint32 mtu)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->ip6_mtu != plat_mtu) {
|
if (priv->ip6_mtu != plat_mtu) {
|
||||||
g_snprintf (val, sizeof (val), "%d", mtu);
|
char val[64];
|
||||||
nm_device_ipv6_sysctl_set (self, "mtu", val);
|
|
||||||
|
nm_device_ipv6_sysctl_set (self, "mtu",
|
||||||
|
nm_sprintf_buf (val, "%u", (unsigned) mtu));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue