summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd/sd-device/device-private.c15
-rw-r--r--src/libsystemd/sd-device/device-private.h1
-rw-r--r--src/libsystemd/sd-device/sd-device.c2
3 files changed, 15 insertions, 3 deletions
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index 36beb3e7df..2daf4ddd57 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -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;
}
diff --git a/src/libsystemd/sd-device/device-private.h b/src/libsystemd/sd-device/device-private.h
index 56558b38c6..062bfd651c 100644
--- a/src/libsystemd/sd-device/device-private.h
+++ b/src/libsystemd/sd-device/device-private.h
@@ -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);
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index b8a5dcc1a6..2a69f2e94b 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -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);