summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libudev/libudev-device.c8
-rw-r--r--src/udev/udev-event.c10
2 files changed, 9 insertions, 9 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index d0296b7ccb..978b03dd0d 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -1926,6 +1926,7 @@ void udev_device_set_db_persist(struct udev_device *udev_device)
int udev_device_rename(struct udev_device *udev_device, const char *name)
{
_cleanup_free_ char *dirname = NULL;
+ const char *interface;
char *new_syspath;
int r;
@@ -1942,6 +1943,13 @@ int udev_device_rename(struct udev_device *udev_device, const char *name)
if (r < 0)
return r;
+ interface = udev_device_get_property_value(udev_device, "INTERFACE");
+ if (interface) {
+ /* like DEVPATH_OLD, INTERFACE_OLD is not saved to the db, but only stays around for the current event */
+ udev_device_add_property(udev_device, "INTERFACE_OLD", interface);
+ udev_device_add_property(udev_device, "INTERFACE", name);
+ }
+
return 0;
}
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 1c5d5e9a49..e5a5175df9 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -849,20 +849,12 @@ void udev_event_execute_rules(struct udev_event *event,
log_warning_errno(r, "could not rename interface '%d' from '%s' to '%s': %m", udev_device_get_ifindex(dev),
udev_device_get_sysname(dev), event->name);
else {
- const char *interface_old;
-
- /* remember old name */
- interface_old = udev_device_get_sysname(dev);
-
r = udev_device_rename(dev, event->name);
if (r < 0)
log_warning_errno(r, "renamed interface '%d' from '%s' to '%s', but could not update udev_device: %m",
udev_device_get_ifindex(dev), udev_device_get_sysname(dev), event->name);
- else {
- udev_device_add_property(dev, "INTERFACE_OLD", interface_old);
- udev_device_add_property(dev, "INTERFACE", event->name);
+ else
log_debug("changed devpath to '%s'", udev_device_get_devpath(dev));
- }
}
}