From fccdeb7e2c7232b4609edaae84f578b73b63cfff Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Thu, 17 Feb 2022 18:30:00 +0100 Subject: [PATCH] [LinuxVersion] Do not log a warning if there are non-digits chars found A Linux version including non-digits, like 5.15.23-gentoo-dist, is very common and nothing we should warn about. --- emper/lib/LinuxVersion.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/emper/lib/LinuxVersion.cpp b/emper/lib/LinuxVersion.cpp index 0c819773..614407ce 100644 --- a/emper/lib/LinuxVersion.cpp +++ b/emper/lib/LinuxVersion.cpp @@ -8,7 +8,6 @@ #include <cstdlib> #include "Common.hpp" -#include "Debug.hpp" static auto checked_strtol(const std::string& s) -> long { static const int DECIMAL = 10; @@ -25,9 +24,11 @@ static auto checked_strtol(const std::string& s) -> long { DIE_MSG("strtol found no digits in " << s); } - if (endptr != startptr + s.size()) { - LOGW("LinuxVersion compare ignored non digits in " << s) - } + // TODO: We could report remaining bytes of the string by returning + // std::string(endptr) together with 'res' (potentially using + // std::pair). Not sure if we even need to check if "endptr != + // startptr + s.size()", or if we could always cosntruct + // std::string(endptr), potentially constructing the empty string. return res; } -- GitLab