From 3e83fb9fb2c5d5c103ae519633621173a6294718 Mon Sep 17 00:00:00 2001 From: Hayden Sartoris Date: Fri, 27 Sep 2019 11:01:45 -0400 Subject: [PATCH] net: Don't disable when linkspeed not detected (#1772) Shows "N/A" instead. Fixes #1211 --- src/adapters/net.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/adapters/net.cpp b/src/adapters/net.cpp index 74702bab..0b79e123 100644 --- a/src/adapters/net.cpp +++ b/src/adapters/net.cpp @@ -270,11 +270,11 @@ namespace net { request.ifr_data = reinterpret_cast(&data); if (ioctl(*m_socketfd, SIOCETHTOOL, &request) == -1) { - return false; + m_linkspeed = -1; + } else { + m_linkspeed = data.speed; } - m_linkspeed = data.speed; - return true; } @@ -306,7 +306,7 @@ namespace net { * about the current connection */ string wired_network::linkspeed() const { - return (m_linkspeed == 0 ? "???" : to_string(m_linkspeed)) + " Mbit/s"; + return m_linkspeed == -1 ? "N/A" : (to_string(m_linkspeed) + " Mbit/s"); } // }}}