[dbus PATCH 6/9] domain: Return error if libvirt API fails

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/domain.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/domain.c b/src/domain.c
index 20d41fe..b361aa6 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1339,7 +1339,10 @@ virtDBusDomainGetMemoryParameters(GVariant *inArgs,
         return;
 
     ret = virDomainGetMemoryParameters(domain, NULL, &params.nparams, flags);
-    if (ret == 0 && params.nparams != 0) {
+    if (ret < 0)
+        return virtDBusUtilSetLastVirtError(error);
+
+    if (params.nparams != 0) {
         params.params = g_new0(virTypedParameter, params.nparams);
         if (virDomainGetMemoryParameters(domain, params.params,
                                          &params.nparams, flags) < 0) {
@@ -1475,7 +1478,10 @@ virtDBusDomainGetSchedulerParameters(GVariant *inArgs,
         return;
 
     ret = virDomainGetSchedulerType(domain, &params.nparams);
-    if (ret && params.nparams != 0) {
+    if (!ret)
+        return virtDBusUtilSetLastVirtError(error);
+
+    if (params.nparams != 0) {
         params.params = g_new0(virTypedParameter, params.nparams);
         if (virDomainGetSchedulerParametersFlags(domain, params.params,
                                                  &params.nparams, 0))
-- 
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