mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 20:40:06 +01: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);
|
||||
guint32 ip_mtu = get_ip_mtu (self);
|
||||
guint32 plat_mtu = nm_device_ipv6_sysctl_get_int32 (self, "mtu", ip_mtu);
|
||||
char val[16];
|
||||
|
||||
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) {
|
||||
g_snprintf (val, sizeof (val), "%d", mtu);
|
||||
nm_device_ipv6_sysctl_set (self, "mtu", val);
|
||||
char val[64];
|
||||
|
||||
nm_device_ipv6_sysctl_set (self, "mtu",
|
||||
nm_sprintf_buf (val, "%u", (unsigned) mtu));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue