summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-01-13 11:14:12 +0100
committerThomas Haller <thaller@redhat.com>2017-01-13 11:14:12 +0100
commit85c38d18a00ef9c7dfca4bce2ffac8fab2c377ef (patch)
tree2f159e2d2bd9927b1e19a5b16b95df0b25480601
parent334a8a54be55cc223dfd553f8d6e14f15a995561 (diff)
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().
-rw-r--r--src/devices/nm-device.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f172ec2c6f..fe5e930e41 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -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));
}
}