aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-sockets.c
diff options
context:
space:
mode:
authorCao jin <caoj.fnst@cn.fujitsu.com>2016-07-28 16:54:33 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2016-09-13 19:08:42 +0200
commit260150512156b475e923b853b39c354f6ddd764e (patch)
tree89d4f27b31b7eb984cbfd16a37df67cb40d3a353 /util/qemu-sockets.c
parent9cd1883c0d01813c47e0153459068f22895f4ade (diff)
util: fix some coding style issue
Fix some coding style issues found in removing NonBlockingConnectHandler. Cc: Daniel P. Berrange <berrange@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Reviwed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Message-Id: <1469696074-12744-3-git-send-email-caoj.fnst@cn.fujitsu.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/qemu-sockets.c')
-rw-r--r--util/qemu-sockets.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 9fa01560ce..6db48b3f2e 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -494,7 +494,7 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
if ((rc = getaddrinfo(addr, port, &ai, &peer)) != 0) {
error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
gai_strerror(rc));
- goto err;
+ goto err;
}
/* lookup local addr */
@@ -548,12 +548,16 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
return sock;
err:
- if (-1 != sock)
+ if (sock != -1) {
closesocket(sock);
- if (local)
+ }
+ if (local) {
freeaddrinfo(local);
- if (peer)
+ }
+ if (peer) {
freeaddrinfo(peer);
+ }
+
return -1;
}
@@ -816,8 +820,10 @@ int unix_listen(const char *str, char *ostr, int olen, Error **errp)
sock = unix_listen_saddr(saddr, true, errp);
- if (sock != -1 && ostr)
+ if (sock != -1 && ostr) {
snprintf(ostr, olen, "%s%s", saddr->path, optstr ? optstr : "");
+ }
+
qapi_free_UnixSocketAddress(saddr);
return sock;
}