[libvirt] [PATCH v4 3/4] util: Move error reporting back to virFileWrapperFdClose()

Andrea Bolognani posted 4 patches 5 years, 9 months ago
[libvirt] [PATCH v4 3/4] util: Move error reporting back to virFileWrapperFdClose()
Posted by Andrea Bolognani 5 years, 9 months ago
virFileWrapperFdFree(), like all free functions, is supposed
to only release allocated resources, so error reporting is
better suited for virFileWrapperFdClose().

This reverts commit b0c3e931804a86cd7146db0164ab4843039c410b.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/util/virfile.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 42add5a2cd..d35206b0dd 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -337,6 +337,9 @@ virFileWrapperFdClose(virFileWrapperFdPtr wfd)
 
     ret = virCommandWait(wfd->cmd, NULL);
 
+    if (wfd->err_msg && *wfd->err_msg)
+        VIR_WARN("iohelper reports: %s", wfd->err_msg);
+
     wfd->closed = true;
 
     return ret;
@@ -357,11 +360,6 @@ virFileWrapperFdFree(virFileWrapperFdPtr wfd)
     if (!wfd)
         return;
 
-    if (wfd->err_msg && *wfd->err_msg)
-        VIR_WARN("iohelper reports: %s", wfd->err_msg);
-
-    virCommandAbort(wfd->cmd);
-
     VIR_FREE(wfd->err_msg);
     virCommandFree(wfd->cmd);
     VIR_FREE(wfd);
-- 
2.20.1

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