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

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

 



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@xxxxxxxxxx>

---

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

 

--
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]