From 522456b9f3ab07a78de17bf693abead4a296b028 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sun, 12 Aug 2018 22:08:22 +0200 Subject: device: gracefully handle device names exceeding IFNAMESIZ Instead of truncating the device name when it exceeds IFNAMSIZ length; let device_set_ifname return an error code and do not add the device to the device list. This avoids possible issues with device names becoming identical due the truncation and as a result unexpected behavior. Further let the different device types gracefully handle the error code returned by device_init Signed-off-by: Hans Dedecker --- device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'device.h') diff --git a/device.h b/device.h index 84acf52..63f937a 100644 --- a/device.h +++ b/device.h @@ -250,7 +250,7 @@ device_apply_config(struct device *dev, struct device_type *type, void device_reset_config(void); void device_reset_old(void); -void device_init_virtual(struct device *dev, struct device_type *type, const char *name); +int device_init_virtual(struct device *dev, struct device_type *type, const char *name); int device_init(struct device *dev, struct device_type *type, const char *ifname); void device_cleanup(struct device *dev); struct device *device_find(const char *name); -- cgit v1.2.3