[libvirt] [PATCH 1/2] util: replace error with cleanup in virNetlinkCommand

Wangrui (K) moon.wangrui at huawei.com
Mon May 12 11:08:04 UTC 2014


In funtcion virNetlinkCommand, it uses the word "error" as the goto out
keyword, but it's not an error-handling branch, so, use "cleanup" instead.

Signed-off-by: Zhang Bo <oscar.zhangbo at huawei.com>
---
src/util/virnetlink.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 1a09567..4f4dedc 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -212,7 +212,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
                         _("cannot connect to netlink socket with protocol %d"),
                              protocol);
         rc = -1;
-        goto error;
+        goto cleanup;
     }
     fd = nl_socket_get_fd(nlhandle);
@@ -220,14 +220,14 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
         virReportSystemError(errno,
                              "%s", _("cannot get netlink socket fd"));
         rc = -1;
-        goto error;
+        goto cleanup ;
     }
     if (groups && nl_socket_add_membership(nlhandle, groups) < 0) {
         virReportSystemError(errno,
                              "%s", _("cannot add netlink membership"));
         rc = -1;
-        goto error;
+        goto cleanup;
     }
     nlmsg_set_dst(nl_msg, &nladdr);
@@ -239,7 +239,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
         virReportSystemError(errno,
                              "%s", _("cannot send to netlink socket"));
         rc = -1;
-        goto error;
+        goto cleanup;
     }
     memset(fds, 0, sizeof(fds));
@@ -255,7 +255,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
             virReportSystemError(ETIMEDOUT, "%s",
                                  _("no valid netlink response was received"));
         rc = -1;
-        goto error;
+        goto cleanup;
     }
     length = nl_recv(nlhandle, &nladdr,
@@ -268,7 +268,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
     } else {
         *respbuflen = length;
     }
- error:
+ cleanup:
     if (rc == -1) {
         VIR_FREE(*resp);
         *resp = NULL;
--
1.7.12.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140512/86939409/attachment-0001.htm>


More information about the libvir-list mailing list