lsblk: normalize space in SERIAL and MODEL
These strings come from HW and udev does not modify it. It seems good idea to clean up it before we print it. Fixes: https://github.com/karelzak/util-linux/issues/1368 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
9c092ff340
commit
16a1c8dcdf
|
@ -112,15 +112,19 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
|
||||||
data = udev_device_get_property_value(dev, "ID_SERIAL_SHORT");
|
data = udev_device_get_property_value(dev, "ID_SERIAL_SHORT");
|
||||||
if(!data)
|
if(!data)
|
||||||
data = udev_device_get_property_value(dev, "ID_SERIAL");
|
data = udev_device_get_property_value(dev, "ID_SERIAL");
|
||||||
if (data)
|
if (data) {
|
||||||
prop->serial = xstrdup(data);
|
prop->serial = xstrdup(data);
|
||||||
|
normalize_whitespace((unsigned char *) prop->serial);
|
||||||
|
}
|
||||||
|
|
||||||
if ((data = udev_device_get_property_value(dev, "ID_MODEL_ENC"))) {
|
if ((data = udev_device_get_property_value(dev, "ID_MODEL_ENC"))) {
|
||||||
prop->model = xstrdup(data);
|
prop->model = xstrdup(data);
|
||||||
unhexmangle_string(prop->model);
|
unhexmangle_string(prop->model);
|
||||||
normalize_whitespace((unsigned char *) prop->model);
|
normalize_whitespace((unsigned char *) prop->model);
|
||||||
} else if ((data = udev_device_get_property_value(dev, "ID_MODEL")))
|
} else if ((data = udev_device_get_property_value(dev, "ID_MODEL"))) {
|
||||||
prop->model = xstrdup(data);
|
prop->model = xstrdup(data);
|
||||||
|
normalize_whitespace((unsigned char *) prop->model);
|
||||||
|
}
|
||||||
|
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
DBG(DEV, ul_debugobj(ld, "%s: found udev properties", ld->name));
|
DBG(DEV, ul_debugobj(ld, "%s: found udev properties", ld->name));
|
||||||
|
|
Loading…
Reference in New Issue