initialize device names earlier
authorFelix Fietkau <nbd@openwrt.org>
Sun, 3 Apr 2011 16:52:31 +0000 (18:52 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 3 Apr 2011 16:52:31 +0000 (18:52 +0200)
device.c

index 1f84a83..0efdba5 100644 (file)
--- a/device.c
+++ b/device.c
@@ -93,12 +93,12 @@ void init_virtual_device(struct device *dev, const struct device_type *type, con
        assert(dev);
        assert(type);
 
+       if (name)
+               strncpy(dev->ifname, name, IFNAMSIZ);
+
        fprintf(stderr, "Initialize interface '%s'\n", dev->ifname);
        INIT_LIST_HEAD(&dev->users);
        dev->type = type;
-
-       if (name)
-               strncpy(dev->ifname, name, IFNAMSIZ);
 }
 
 int init_device(struct device *dev, const struct device_type *type, const char *ifname)