[libvirt] [PATCH 1/5] nodedev: mdev: Report an error when virFileResolveLink fails

Erik Skultety posted 5 patches 7 years, 9 months ago
[libvirt] [PATCH 1/5] nodedev: mdev: Report an error when virFileResolveLink fails
Posted by Erik Skultety 7 years, 9 months ago
It might happen that virFileResolveLinkHelper fails on the lstat system
call. virFileResolveLink expects the caller to report an error when it
fails, however this wasn't the case for udevProcessMediatedDevice.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 src/node_device/node_device_udev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 4762f1969..80c346e96 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1121,8 +1121,10 @@ udevProcessMediatedDevice(struct udev_device *dev,
     if (virAsprintf(&linkpath, "%s/mdev_type", udev_device_get_syspath(dev)) < 0)
         goto cleanup;
 
-    if (virFileResolveLink(linkpath, &canonicalpath) < 0)
+    if (virFileResolveLink(linkpath, &canonicalpath) < 0) {
+        virReportSystemError(errno, _("failed to resolve '%s'"), linkpath);
         goto cleanup;
+    }
 
     if (VIR_STRDUP(data->type, last_component(canonicalpath)) < 0)
         goto cleanup;
-- 
2.13.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/5] nodedev: mdev: Report an error when virFileResolveLink fails
Posted by John Ferlan 7 years, 9 months ago

On 07/26/2017 02:44 AM, Erik Skultety wrote:
> It might happen that virFileResolveLinkHelper fails on the lstat system
> call. virFileResolveLink expects the caller to report an error when it
> fails, however this wasn't the case for udevProcessMediatedDevice.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  src/node_device/node_device_udev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Could have gone with "resolve mdev path" or "resolve mediated device
path"...  Just makes it clear what failed.


Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list