[PATCH v2 06/21] conf: Improve error handling in virDomainChrDefFormat()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We don't need to store the return value since we never modify it; we
should also report failure when virDomainChrSourceDefFormat() fails.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 224b88d9a..cb4ed6ef6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24025,8 +24025,6 @@ virDomainChrDefFormat(virBufferPtr buf,
     const char *elementName = virDomainChrDeviceTypeToString(def->deviceType);
     bool tty_compat;
 
-    int ret = 0;
-
     if (!elementName) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unexpected char device type %d"),
@@ -24044,7 +24042,9 @@ virDomainChrDefFormat(virBufferPtr buf,
     if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0)
         return -1;
     virBufferAddLit(buf, ">\n");
-    virDomainChrSourceDefFormat(buf, def->source, flags);
+
+    if (virDomainChrSourceDefFormat(buf, def->source, flags) < 0)
+       return -1;
 
     if (virDomainChrTargetDefFormat(buf, def, flags) < 0)
        return -1;
@@ -24054,7 +24054,7 @@ virDomainChrDefFormat(virBufferPtr buf,
     virBufferAdjustIndent(buf, -2);
     virBufferAsprintf(buf, "</%s>\n", elementName);
 
-    return ret;
+    return 0;
 }
 
 static int
-- 
2.14.3

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux