diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2018-07-16 23:03:25 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2018-07-17 23:12:03 +0200 |
commit | 263631ae5a22daa90743d9758f44f1df109dc990 (patch) | |
tree | 117cdac6adde45e0e3458ca3150c060ac440f411 | |
parent | 291ccbb8de51ced6d80a7417abf9d85fd8e16fbb (diff) |
vlan: use alloca to get rid of IFNAMSIZE in vlan_dev_set_name()
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r-- | vlan.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -63,10 +63,12 @@ static int vlan_set_device_state(struct device *dev, bool up) static void vlan_dev_set_name(struct vlan_device *vldev, struct device *dev) { - char name[IFNAMSIZ]; + char *name; + name = alloca(strlen(dev->ifname) + sizeof(".2147483647\0")); vldev->dev.hidden = dev->hidden; - snprintf(name, IFNAMSIZ, "%s.%d", dev->ifname, vldev->id); + sprintf(name, "%s.%d", dev->ifname, vldev->id); + device_set_ifname(&vldev->dev, name); } |