You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/05/20 00:10:05 UTC
[1/2] mesos git commit: Removed bad call to freeaddrinfo in
net::hostname.
Repository: mesos
Updated Branches:
refs/heads/master c24268f13 -> d59fb3822
Removed bad call to freeaddrinfo in net::hostname.
Review: https://reviews.apache.org/r/34438
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/08e11d37
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/08e11d37
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/08e11d37
Branch: refs/heads/master
Commit: 08e11d372afbb66907130998b485c185687fae34
Parents: c24268f
Author: Chi Zhang <ch...@gmail.com>
Authored: Tue May 19 15:03:23 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Tue May 19 15:05:02 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/08e11d37/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
index 23d086b..cf0090b 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
@@ -146,14 +146,11 @@ inline Try<std::string> hostname()
// TODO(evelinad): Add AF_UNSPEC when we will support IPv6
struct addrinfo hints = createAddrInfo(SOCK_STREAM, AF_INET, AI_CANONNAME);
- struct addrinfo *result;
+ struct addrinfo* result = NULL;
int error = getaddrinfo(host, NULL, &hints, &result);
- if (error != 0 || result == NULL) {
- if (result != NULL) {
- freeaddrinfo(result);
- }
+ if (error != 0) {
return Error(gai_strerror(error));
}
[2/2] mesos git commit: Style fixes for net::getIP.
Posted by bm...@apache.org.
Style fixes for net::getIP.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d59fb382
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d59fb382
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d59fb382
Branch: refs/heads/master
Commit: d59fb38223156e46a37a00d79ca21b0993ad03c9
Parents: 08e11d3
Author: Benjamin Mahler <be...@gmail.com>
Authored: Tue May 19 15:07:25 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Tue May 19 15:07:25 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d59fb382/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
index cf0090b..0c09b34 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
@@ -190,22 +190,25 @@ inline Try<std::string> getHostname(const IP& ip)
// obtained.
inline Try<IP> getIP(const std::string& hostname, int family)
{
- struct addrinfo hints;
+ struct addrinfo hints = createAddrInfo(SOCK_STREAM, family, 0);
struct addrinfo* result = NULL;
- hints = createAddrInfo(SOCK_STREAM, family, 0);
+
int error = getaddrinfo(hostname.c_str(), NULL, &hints, &result);
+
if (error != 0) {
return Error(gai_strerror(error));
}
+
if (result->ai_addr == NULL) {
freeaddrinfo(result);
- return Error("Got no addresses for '" + hostname + "'");
+ return Error("No addresses found");
}
Try<IP> ip = IP::create(*result->ai_addr);
+
if (ip.isError()) {
freeaddrinfo(result);
- return Error("Unsupported family type: " + stringify(family));
+ return Error("Unsupported family type");
}
freeaddrinfo(result);