diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-03-19 09:56:53 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-03-19 09:56:53 +0100 |
commit | eb5b86405b14ca2ac2508f9dec9862cc57110131 (patch) | |
tree | 5b2e7b2eb4d0dc29242e87c40bf4ad47d848c915 /udev_device.c | |
parent | 3045132a0df944c33f459f4e8cafdc6b84800174 (diff) |
update %n on netif name change
Diffstat (limited to 'udev_device.c')
-rw-r--r-- | udev_device.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/udev_device.c b/udev_device.c index 24f65ca045..03514e1d48 100644 --- a/udev_device.c +++ b/udev_device.c @@ -204,6 +204,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->dev->kernel) != 0) { + char devpath[PATH_MAX]; char *pos; retval = rename_netif(udev); @@ -214,14 +215,16 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* export old name */ setenv("INTERFACE_OLD", udev->dev->kernel, 1); - /* now fake the devpath, because the kernel name changed silently */ - pos = strrchr(udev->dev->devpath, '/'); + /* now change the devpath, because the kernel device name has changed */ + strlcpy(devpath, udev->dev->devpath, sizeof(devpath)); + pos = strrchr(devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath)); - strlcpy(udev->dev->kernel, udev->name, sizeof(udev->dev->kernel)); + strlcat(devpath, udev->name, sizeof(devpath)); + sysfs_device_set_values(udev->dev, devpath, NULL, NULL); setenv("DEVPATH", udev->dev->devpath, 1); setenv("INTERFACE", udev->name, 1); + info("changed devpath to '%s'", udev->dev->devpath); } } goto exit; |