sd-device: also store properties read from udev database to sd_device::properties_db

Follow-up for a3ce813697 and
5ce41697bd.

Before a3ce813697, all properties in
src->properties and src->properties_db are mixed and copied to
dst->properties_db by device_copy_properties().
So, it is not necessary to store data from udev database file to
sd_device::properties_db before copying properties.

But now, properties are not mixed. So, the read data need to be
stored to also ::properties_db.

Fixes #11721.
This commit is contained in:
Yu Watanabe 2019-02-16 05:21:59 +09:00
parent 63eb09569a
commit 03dd7b7dde

View file

@ -1110,6 +1110,7 @@ int device_add_devlink(sd_device *device, const char *devlink) {
static int device_add_property_internal_from_string(sd_device *device, const char *str) {
_cleanup_free_ char *key = NULL;
char *value;
int r;
assert(device);
assert(str);
@ -1127,7 +1128,13 @@ static int device_add_property_internal_from_string(sd_device *device, const cha
if (isempty(++value))
value = NULL;
return device_add_property_internal(device, key, value);
/* Add the property to both sd_device::properties and sd_device::properties_db,
* as this is called by only handle_db_line(). */
r = device_add_property_aux(device, key, value, false);
if (r < 0)
return r;
return device_add_property_aux(device, key, value, true);
}
int device_set_usec_initialized(sd_device *device, usec_t when) {