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

[Xen-changelog] [xen master] libxl/colo: unified exit path for colo_proxy_checkpoint



commit c6e2216783b2572912ee5a7938166a29e244fa37
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Mar 15 10:50:19 2017 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Thu Mar 16 18:25:16 2017 +0000

    libxl/colo: unified exit path for colo_proxy_checkpoint
    
    Slightly refactor the code to have only one exit path for the said
    function.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Zhang Chen <zhangchen.fnst@xxxxxxxxxxxxxx>
---
 tools/libxl/libxl_colo_proxy.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c
index c3d5510..5475f7e 100644
--- a/tools/libxl/libxl_colo_proxy.c
+++ b/tools/libxl/libxl_colo_proxy.c
@@ -375,7 +375,7 @@ typedef struct colo_msg {
 int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
                           unsigned int timeout_us)
 {
-    uint8_t *buff;
+    uint8_t *buff = NULL;
     int64_t size;
     struct nlmsghdr *h;
     struct colo_msg *m;
@@ -396,7 +396,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
         ret = colo_userspace_proxy_recv(cps, recvbuff, timeout_us);
         if (ret <= 0) {
             ret = 0;
-            goto out1;
+            goto out;
         }
 
         if (!strcmp(recvbuff, "DO_CHECKPOINT")) {
@@ -405,14 +405,16 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
             LOGD(ERROR, ao->domid, "receive qemu colo-compare checkpoint 
error");
             ret = 0;
         }
-        goto out1;
+        goto out;
     }
 
     size = colo_proxy_recv(cps, &buff, timeout_us);
 
     /* timeout, return no checkpoint message. */
-    if (size <= 0)
-        return 0;
+    if (size <= 0) {
+        ret = 0;
+        goto out;
+    }
 
     h = (struct nlmsghdr *) buff;
 
@@ -433,7 +435,4 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
 out:
     free(buff);
     return ret;
-
-out1:
-    return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.