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"); } // }}}