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

[Xen-devel] [PATCH v2 07/11] tools/libvchan: init_xs_srv: Simplify error handling (2)



* Abolish fail_xs_open which is now exactly the same as fail.

* Change all gotos to refer to fail instead.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 tools/libvchan/init.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
index 9c61c720d1..f099765a38 100644
--- a/tools/libvchan/init.c
+++ b/tools/libvchan/init.c
@@ -256,7 +256,7 @@ static int init_xs_srv(struct libxenvchan *ctrl, int 
domain, const char* xs_base
                goto fail;
        domid_str = xs_read(xs, 0, "domid", NULL);
        if (!domid_str)
-               goto fail_xs_open;
+               goto fail;
 
        // owner domain is us
        perms[0].id = atoi(domid_str);
@@ -269,21 +269,21 @@ static int init_xs_srv(struct libxenvchan *ctrl, int 
domain, const char* xs_base
 retry_transaction:
        xs_trans = xs_transaction_start(xs);
        if (!xs_trans)
-               goto fail_xs_open;
+               goto fail;
 
        snprintf(ref, sizeof ref, "%d", ring_ref);
        snprintf(buf, sizeof buf, "%s/ring-ref", xs_base);
        if (!xs_write(xs, xs_trans, buf, ref, strlen(ref)))
-               goto fail_xs_open;
+               goto fail;
        if (!xs_set_permissions(xs, xs_trans, buf, perms, 2))
-               goto fail_xs_open;
+               goto fail;
 
        snprintf(ref, sizeof ref, "%d", ctrl->event_port);
        snprintf(buf, sizeof buf, "%s/event-channel", xs_base);
        if (!xs_write(xs, xs_trans, buf, ref, strlen(ref)))
-               goto fail_xs_open;
+               goto fail;
        if (!xs_set_permissions(xs, xs_trans, buf, perms, 2))
-               goto fail_xs_open;
+               goto fail;
 
        if (!xs_transaction_end(xs, xs_trans, 0)) {
                if (errno == EAGAIN)
@@ -291,7 +291,6 @@ retry_transaction:
        } else {
                ret = 0;
        }
- fail_xs_open:
  fail:
        free(domid_str);
        xs_close(xs);
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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