From 4ca5bbddd3939fc95db14a51c6bb8028f7d00002 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 14 Apr 2017 12:52:30 +0800 Subject: [PATCH] msg/async: only check errno if setsockopt() fails Signed-off-by: Kefu Chai --- src/msg/async/net_handler.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/msg/async/net_handler.cc b/src/msg/async/net_handler.cc index 53ffdb7da93..059f9220948 100644 --- a/src/msg/async/net_handler.cc +++ b/src/msg/async/net_handler.cc @@ -139,7 +139,8 @@ void NetHandler::set_priority(int sd, int prio, int domain) } } else if (domain == AF_INET6) { r = ::setsockopt(sd, IPPROTO_IPV6, IPV6_TCLASS, &iptos, sizeof(iptos)); - r = -errno; + if (r) + r = -errno; if (r < 0) { ldout(cct,0) << "couldn't set IPV6_TCLASS to " << iptos << ": " << cpp_strerror(r) << dendl; -- 2.47.3