Repository: mesos
Updated Branches:
  refs/heads/master b89667ca9 -> dc7e42657


Included the error message when nl_connect fails.

Review: https://reviews.apache.org/r/21595


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dc7e4265
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dc7e4265
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dc7e4265

Branch: refs/heads/master
Commit: dc7e4265701de24768c9a469ec71c195a06f3be1
Parents: b89667c
Author: Jie Yu <yujie....@gmail.com>
Authored: Fri May 16 16:15:10 2014 -0700
Committer: Jie Yu <yujie....@gmail.com>
Committed: Mon May 19 10:17:03 2014 -0700

----------------------------------------------------------------------
 src/linux/routing/internal.hpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dc7e4265/src/linux/routing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/internal.hpp b/src/linux/routing/internal.hpp
index be117da..8971840 100644
--- a/src/linux/routing/internal.hpp
+++ b/src/linux/routing/internal.hpp
@@ -20,6 +20,7 @@
 #define __LINUX_ROUTING_INTERNAL_HPP__
 
 #include <netlink/cache.h>
+#include <netlink/errno.h>
 #include <netlink/netlink.h>
 #include <netlink/socket.h>
 
@@ -27,6 +28,8 @@
 #include <netlink/route/link.h>
 #include <netlink/route/qdisc.h>
 
+#include <string>
+
 #include <stout/error.hpp>
 #include <stout/memory.hpp>
 #include <stout/try.hpp>
@@ -92,8 +95,12 @@ inline Try<Netlink<struct nl_sock> > socket()
   }
 
   Netlink<struct nl_sock> sock(s);
-  if (nl_connect(sock.get(), NETLINK_ROUTE) != 0) {
-    return Error("Failed to connect to routing netlink protocol");
+
+  int err = nl_connect(sock.get(), NETLINK_ROUTE);
+  if (err != 0) {
+    return Error(
+        "Failed to connect to routing netlink protocol: " +
+        std::string(nl_geterror(err)));
   }
 
   return sock;

Reply via email to