Skip to content

Commit

Permalink
util: fix some coding style issue
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cao jin authored and bonzini committed Sep 13, 2016
1 parent 9cd1883 commit 2601505
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions util/qemu-sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2601505

Please sign in to comment.