X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_device.c;h=bbf7963afce78897f38d88eca4a2b23efade9853;hb=3bf1efa8ddee3999656b0454734bc6b39fc7c00b;hp=24f65ca045d2c39f170c7f0093b2fba2745966db;hpb=24f0605c1fec98b77eddb880a405289b08cb5670;p=elogind.git diff --git a/udev_device.c b/udev_device.c index 24f65ca04..bbf7963af 100644 --- a/udev_device.c +++ b/udev_device.c @@ -164,6 +164,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* read current database entry; cleanup, if it is known device */ udev_old = udev_device_init(NULL); if (udev_old != NULL) { + udev_old->test_run = udev->test_run; if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { info("device '%s' already in database, cleanup", udev->dev->devpath); udev_db_delete_device(udev_old); @@ -204,6 +205,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 +216,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; @@ -235,8 +239,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (udev_db_get_device(udev, udev->dev->devpath) == 0) { udev_db_delete_device(udev); if (udev->ignore_remove) { - dbg("remove event for '%s' requested to be ignored by rule", udev->name); - return 0; + info("ignore_remove for '%s'", udev->name); + goto exit; } /* restore stored persistent data */ list_for_each_entry(name_loop, &udev->env_list, node)