From e2859b9dcdd50253999e3229e7dd9b5bca7c884c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 3 Jun 2016 19:33:05 +0200 Subject: [PATCH] udevProcessStorage: trim all whitespace from model and vendor Use virTrimSpaces instead of a custom implementation. --- src/node_device/node_device_udev.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 84bea5040e..1529c5a33b 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -839,20 +839,6 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def) } -static void udevStripSpaces(char *s) -{ - if (s == NULL) - return; - - while (virFileStripSuffix(s, " ")) { - /* do nothing */ - ; - } - - return; -} - - static int udevProcessStorage(struct udev_device *device, virNodeDeviceDefPtr def) { @@ -876,10 +862,13 @@ static int udevProcessStorage(struct udev_device *device, if (udevGetStringSysfsAttr(device, "device/vendor", &data->storage.vendor) < 0) goto out; - udevStripSpaces(def->caps->data.storage.vendor); + if (def->caps->data.storage.vendor) + virTrimSpaces(def->caps->data.storage.vendor, NULL); + if (udevGetStringSysfsAttr(device, "device/model", &data->storage.model) < 0) goto out; - udevStripSpaces(def->caps->data.storage.model); + if (def->caps->data.storage.model) + virTrimSpaces(def->caps->data.storage.model, NULL); /* There is no equivalent of the hotpluggable property in libudev, * but storage is going toward a world in which hotpluggable is * expected, so I don't see a problem with not having a property -- GitLab