[dbus PATCH 14/18] connect: parse message arguments as first thing

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

 



There is no need to open connection if parsing arguments fails.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/connect.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/connect.c b/src/connect.c
index b31f08e..695fc0d 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -120,11 +120,11 @@ virtDBusConnectListDomains(sd_bus_message *message,
     uint32_t flags;
     int r;
 
-    r = virtDBusConnectOpen(connect, error);
+    r = sd_bus_message_read(message, "u", &flags);
     if (r < 0)
         return r;
 
-    r = sd_bus_message_read(message, "u", &flags);
+    r = virtDBusConnectOpen(connect, error);
     if (r < 0)
         return r;
 
@@ -170,11 +170,11 @@ virtDBusConnectCreateXML(sd_bus_message *message,
     _cleanup_(virtDBusUtilFreep) char *path = NULL;
     int r;
 
-    r = virtDBusConnectOpen(connect, error);
+    r = sd_bus_message_read(message, "su", &xml, &flags);
     if (r < 0)
         return r;
 
-    r = sd_bus_message_read(message, "su", &xml, &flags);
+    r = virtDBusConnectOpen(connect, error);
     if (r < 0)
         return r;
 
@@ -198,11 +198,11 @@ virtDBusConnectDefineXML(sd_bus_message *message,
     _cleanup_(virtDBusUtilFreep) char *path = NULL;
     int r;
 
-    r = virtDBusConnectOpen(connect, error);
+    r = sd_bus_message_read(message, "s", &xml);
     if (r < 0)
         return r;
 
-    r = sd_bus_message_read(message, "s", &xml);
+    r = virtDBusConnectOpen(connect, error);
     if (r < 0)
         return r;
 
-- 
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