mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
sd-device: do not save e.g., DEVPATH or INTERFACE properties to udev database
Previously, device_copy_properties() copies all properties to both sd_device::properties and ::properties_db. Thus, on move uevent, also tentative properties, e.g. DEVPATH or INTERFACE, are stored to ::properties_db, and saved to udev database. This makes such tentative properties be copied to only ::properties, and thus not saved to udev database. Fixes #9426.
This commit is contained in:
parent
61a38e0265
commit
a3ce813697
@ -702,13 +702,24 @@ int device_new_from_stat_rdev(sd_device **ret, const struct stat *st) {
|
||||
|
||||
int device_copy_properties(sd_device *device_dst, sd_device *device_src) {
|
||||
const char *property, *value;
|
||||
Iterator i;
|
||||
int r;
|
||||
|
||||
assert(device_dst);
|
||||
assert(device_src);
|
||||
|
||||
FOREACH_DEVICE_PROPERTY(device_src, property, value) {
|
||||
r = device_add_property(device_dst, property, value);
|
||||
r = device_properties_prepare(device_src);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
ORDERED_HASHMAP_FOREACH_KEY(property, value, device_src->properties_db, i) {
|
||||
r = device_add_property_aux(device_dst, property, value, true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
ORDERED_HASHMAP_FOREACH_KEY(property, value, device_src->properties, i) {
|
||||
r = device_add_property_aux(device_dst, property, value, false);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ uint64_t device_get_properties_generation(sd_device *device);
|
||||
uint64_t device_get_tags_generation(sd_device *device);
|
||||
uint64_t device_get_devlinks_generation(sd_device *device);
|
||||
|
||||
int device_properties_prepare(sd_device *device);
|
||||
int device_get_properties_nulstr(sd_device *device, const uint8_t **nulstr, size_t *len);
|
||||
int device_get_properties_strv(sd_device *device, char ***strv);
|
||||
|
||||
|
@ -1453,7 +1453,7 @@ _public_ const char *sd_device_get_devlink_next(sd_device *device) {
|
||||
return v;
|
||||
}
|
||||
|
||||
static int device_properties_prepare(sd_device *device) {
|
||||
int device_properties_prepare(sd_device *device) {
|
||||
int r;
|
||||
|
||||
assert(device);
|
||||
|
Loading…
Reference in New Issue
Block a user